~ubuntu-branches/ubuntu/maverick/unity/maverick

« back to all changes in this revision

Viewing changes to unity-private/places/places-place-search-bar.c

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-09-17 14:02:54 UTC
  • mfrom: (1.1.17 upstream)
  • Revision ID: james.westby@ubuntu.com-20100917140254-6cbue12klia2f07l
Tags: 0.2.40-0ubuntu1
* New upstream release:
  - Fix inactive menus accessible (LP: #604505)
  - Fix some more memory leaks (LP: #604777, #621690, #628144)
  - Fix weird behaviors of quicklist (LP: #617339)
  - Provide an "open this folder" button (LP: #633201)
  - Hidden menu causing gap (LP: #600191)
  - Cannot go fullscreen for flash videos (LP: #631381)
  - Can't access menu items from the keyboard (LP: #636728)
  - Don't register for MDRAGs since they aren't used (LP: #632613)
  - Don't run indicator on special launchers (LP: #627488)
  - Center arrows position in folded launcher tiles (LP: #633084)
  - Launcher icons first appear as white upon login (LP: #601093)
  - Removes jittering when rubber band is in use on the launcher (LP: #632991)
  - Mutter restarts on closing almost any application (LP: #634701)
  - Can't launch apps like synaptic with root privileges from launch bar
    (LP: #599298)
  - Launcher tile dragging shouldn't be masked (LP: #631443)
  - Fix Carousel-ed icons have distorted perspective (LP: #607515)
  - Use no longer sync call (LP: #620011)
* update debian/libunity0.symbols

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
typedef struct _UnityPlacesPlaceSearchSectionsBar UnityPlacesPlaceSearchSectionsBar;
68
68
typedef struct _UnityPlacesPlaceSearchSectionsBarClass UnityPlacesPlaceSearchSectionsBarClass;
69
69
 
 
70
#define UNITY_PLACES_TYPE_PLACE_SEARCH_EXTRA_ACTION (unity_places_place_search_extra_action_get_type ())
 
71
#define UNITY_PLACES_PLACE_SEARCH_EXTRA_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_PLACES_TYPE_PLACE_SEARCH_EXTRA_ACTION, UnityPlacesPlaceSearchExtraAction))
 
72
#define UNITY_PLACES_PLACE_SEARCH_EXTRA_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_PLACES_TYPE_PLACE_SEARCH_EXTRA_ACTION, UnityPlacesPlaceSearchExtraActionClass))
 
73
#define UNITY_PLACES_IS_PLACE_SEARCH_EXTRA_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_PLACES_TYPE_PLACE_SEARCH_EXTRA_ACTION))
 
74
#define UNITY_PLACES_IS_PLACE_SEARCH_EXTRA_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_PLACES_TYPE_PLACE_SEARCH_EXTRA_ACTION))
 
75
#define UNITY_PLACES_PLACE_SEARCH_EXTRA_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_PLACES_TYPE_PLACE_SEARCH_EXTRA_ACTION, UnityPlacesPlaceSearchExtraActionClass))
 
76
 
 
77
typedef struct _UnityPlacesPlaceSearchExtraAction UnityPlacesPlaceSearchExtraAction;
 
78
typedef struct _UnityPlacesPlaceSearchExtraActionClass UnityPlacesPlaceSearchExtraActionClass;
 
79
 
70
80
#define UNITY_PLACES_TYPE_PLACE_ENTRY (unity_places_place_entry_get_type ())
71
81
#define UNITY_PLACES_PLACE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_PLACES_TYPE_PLACE_ENTRY, UnityPlacesPlaceEntry))
72
82
#define UNITY_PLACES_IS_PLACE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_PLACES_TYPE_PLACE_ENTRY))
118
128
#define _unity_testing_object_registry_unref0(var) ((var == NULL) ? NULL : (var = (unity_testing_object_registry_unref (var), NULL)))
119
129
typedef struct _UnityPlacesPlaceSearchEntryPrivate UnityPlacesPlaceSearchEntryPrivate;
120
130
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
 
131
 
 
132
#define UNITY_PLACES_TYPE_ACTIVATION_STATUS (unity_places_activation_status_get_type ())
 
133
#define _g_free0(var) (var = (g_free (var), NULL))
121
134
typedef struct _Block5Data Block5Data;
122
135
typedef struct _UnityPlacesPlaceSearchBarBackgroundPrivate UnityPlacesPlaceSearchBarBackgroundPrivate;
123
136
#define _cairo_destroy0(var) ((var == NULL) ? NULL : (var = (cairo_destroy (var), NULL)))
129
142
        UnityPlacesPlaceSearchBarPrivate * priv;
130
143
        UnityPlacesPlaceSearchEntry* entry;
131
144
        UnityPlacesPlaceSearchSectionsBar* sections;
 
145
        UnityPlacesPlaceSearchExtraAction* extra_action;
132
146
};
133
147
 
134
148
struct _UnityPlacesPlaceSearchBarClass {
200
214
        CtkBoxClass parent_class;
201
215
};
202
216
 
 
217
typedef enum  {
 
218
        UNITY_PLACES_ACTIVATION_STATUS_NOT_ACTIVATED,
 
219
        UNITY_PLACES_ACTIVATION_STATUS_ACTIVATED_FALLBACK,
 
220
        UNITY_PLACES_ACTIVATION_STATUS_ACTIVATED_SHOW_DASH,
 
221
        UNITY_PLACES_ACTIVATION_STATUS_ACTIVATED_HIDE_DASH
 
222
} UnityPlacesActivationStatus;
 
223
 
203
224
struct _Block5Data {
204
225
        int _ref_count_;
205
226
        UnityPlacesPlaceSearchBar * self;
233
254
GType unity_places_place_search_bar_get_type (void) G_GNUC_CONST;
234
255
GType unity_places_place_search_entry_get_type (void) G_GNUC_CONST;
235
256
GType unity_places_place_search_sections_bar_get_type (void) G_GNUC_CONST;
 
257
GType unity_places_place_search_extra_action_get_type (void) G_GNUC_CONST;
236
258
GType unity_places_place_get_type (void) G_GNUC_CONST;
237
259
GType unity_places_place_entry_get_type (void) G_GNUC_CONST;
238
260
GType unity_places_place_search_bar_background_get_type (void) G_GNUC_CONST;
264
286
static gboolean _unity_places_place_search_bar_background_update_background_gsource_func (gpointer self);
265
287
static void unity_places_place_search_bar_real_get_preferred_height (ClutterActor* base, float for_width, float* min_height, float* nat_height);
266
288
void unity_places_place_entry_set_search (UnityPlacesPlaceEntry* self, const char* search, GHashTable* hints);
 
289
static void unity_places_place_search_bar_on_extra_action_activated (UnityPlacesPlaceSearchBar* self);
 
290
UnityPlacesPlace* unity_places_place_entry_get_parent (UnityPlacesPlaceEntry* self);
 
291
GType unity_places_activation_status_get_type (void) G_GNUC_CONST;
 
292
UnityPlacesActivationStatus unity_places_place_activate (UnityPlacesPlace* self, const char* uri, const char* mimetype);
267
293
void unity_places_place_search_bar_set_active_entry_view (UnityPlacesPlaceSearchBar* self, UnityPlacesPlaceEntry* entry, gint x, guint section);
268
294
void unity_places_place_search_bar_background_set_entry_position (UnityPlacesPlaceSearchBarBackground* self, gint value);
269
295
void unity_places_place_search_sections_bar_set_active_entry (UnityPlacesPlaceSearchSectionsBar* self, UnityPlacesPlaceEntry* entry);
270
 
static gboolean _lambda41_ (Block5Data* _data5_);
 
296
static gboolean _lambda43_ (Block5Data* _data5_);
271
297
void unity_places_place_search_sections_bar_set_active_section (UnityPlacesPlaceSearchSectionsBar* self, guint section_id);
272
 
static gboolean __lambda41__gsource_func (gpointer self);
 
298
static gboolean __lambda43__gsource_func (gpointer self);
273
299
void unity_places_place_search_navigation_set_active_entry (UnityPlacesPlaceSearchNavigation* self, UnityPlacesPlaceEntry* entry);
274
300
void unity_places_place_search_entry_set_active_entry (UnityPlacesPlaceSearchEntry* self, UnityPlacesPlaceEntry* entry);
 
301
GeeHashMap* unity_places_place_entry_get_hints (UnityPlacesPlaceEntry* self);
 
302
void unity_places_place_search_extra_action_set_icon_from_gicon_string (UnityPlacesPlaceSearchExtraAction* self, const char* icon_string);
275
303
static Block5Data* block5_data_ref (Block5Data* _data5_);
276
304
static void block5_data_unref (Block5Data* _data5_);
277
305
UnityPlacesPlaceSearchNavigation* unity_places_place_search_navigation_new (void);
281
309
static void _unity_places_place_search_bar_on_search_text_changed_unity_places_place_search_entry_text_changed (UnityPlacesPlaceSearchEntry* _sender, const char* text, gpointer self);
282
310
UnityPlacesPlaceSearchSectionsBar* unity_places_place_search_sections_bar_new (void);
283
311
UnityPlacesPlaceSearchSectionsBar* unity_places_place_search_sections_bar_construct (GType object_type);
 
312
UnityPlacesPlaceSearchExtraAction* unity_places_place_search_extra_action_new (void);
 
313
UnityPlacesPlaceSearchExtraAction* unity_places_place_search_extra_action_construct (GType object_type);
 
314
static void _unity_places_place_search_bar_on_extra_action_activated_unity_places_place_search_extra_action_activated (UnityPlacesPlaceSearchExtraAction* _sender, gpointer self);
284
315
UnityPlacesPlaceSearchBarBackground* unity_places_place_search_bar_background_new (UnityPlacesPlaceSearchNavigation* nav, UnityPlacesPlaceSearchEntry* search_entry);
285
316
UnityPlacesPlaceSearchBarBackground* unity_places_place_search_bar_background_construct (GType object_type, UnityPlacesPlaceSearchNavigation* nav, UnityPlacesPlaceSearchEntry* search_entry);
286
317
static GObject * unity_places_place_search_bar_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
392
423
}
393
424
 
394
425
 
 
426
static void unity_places_place_search_bar_on_extra_action_activated (UnityPlacesPlaceSearchBar* self) {
 
427
        g_return_if_fail (self != NULL);
 
428
        if (UNITY_PLACES_IS_PLACE_ENTRY (self->priv->active_entry)) {
 
429
                UnityPlacesActivationStatus _result_;
 
430
                _result_ = unity_places_place_activate (unity_places_place_entry_get_parent (self->priv->active_entry), ".", "");
 
431
                switch (_result_) {
 
432
                        case UNITY_PLACES_ACTIVATION_STATUS_ACTIVATED_SHOW_DASH:
 
433
                        {
 
434
                                break;
 
435
                        }
 
436
                        case UNITY_PLACES_ACTIVATION_STATUS_NOT_ACTIVATED:
 
437
                        case UNITY_PLACES_ACTIVATION_STATUS_ACTIVATED_HIDE_DASH:
 
438
                        case UNITY_PLACES_ACTIVATION_STATUS_ACTIVATED_FALLBACK:
 
439
                        {
 
440
                                unity_shell_hide_unity (unity_global_shell);
 
441
                                break;
 
442
                        }
 
443
                        default:
 
444
                        {
 
445
                                g_warning ("places-place-search-bar.vala:159: Unexpected activation status: %u", (guint) _result_);
 
446
                                break;
 
447
                        }
 
448
                }
 
449
        }
 
450
}
 
451
 
 
452
 
395
453
static gpointer _g_object_ref0 (gpointer self) {
396
454
        return self ? g_object_ref (self) : NULL;
397
455
}
398
456
 
399
457
 
400
 
static gboolean _lambda41_ (Block5Data* _data5_) {
 
458
static gboolean _lambda43_ (Block5Data* _data5_) {
401
459
        UnityPlacesPlaceSearchBar * self;
402
460
        gboolean result = FALSE;
403
461
        self = _data5_->self;
407
465
}
408
466
 
409
467
 
410
 
static gboolean __lambda41__gsource_func (gpointer self) {
 
468
static gboolean __lambda43__gsource_func (gpointer self) {
411
469
        gboolean result;
412
 
        result = _lambda41_ (self);
 
470
        result = _lambda43_ (self);
413
471
        return result;
414
472
}
415
473
 
441
499
        unity_places_place_search_bar_background_set_entry_position (self->priv->bg, x);
442
500
        unity_places_place_search_sections_bar_set_active_entry (self->sections, entry);
443
501
        if (_data5_->section != 0) {
444
 
                g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, __lambda41__gsource_func, block5_data_ref (_data5_), block5_data_unref);
 
502
                g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, __lambda43__gsource_func, block5_data_ref (_data5_), block5_data_unref);
445
503
        }
446
504
        unity_places_place_search_navigation_set_active_entry (self->priv->navigation, entry);
447
505
        unity_places_place_search_entry_set_active_entry (self->entry, entry);
448
506
        clutter_actor_grab_key_focus ((ClutterActor*) self->entry->text);
 
507
        if (unity_places_place_entry_get_hints (entry) != NULL) {
 
508
                char* _tmp1_;
 
509
                gboolean _tmp2_;
 
510
                if ((_tmp2_ = (_tmp1_ = (char*) gee_abstract_map_get ((GeeAbstractMap*) unity_places_place_entry_get_hints (entry), "UnityExtraAction")) != NULL, _g_free0 (_tmp1_), _tmp2_)) {
 
511
                        char* _tmp3_;
 
512
                        unity_places_place_search_extra_action_set_icon_from_gicon_string (self->extra_action, _tmp3_ = (char*) gee_abstract_map_get ((GeeAbstractMap*) unity_places_place_entry_get_hints (entry), "UnityExtraAction"));
 
513
                        _g_free0 (_tmp3_);
 
514
                        clutter_actor_show ((ClutterActor*) self->extra_action);
 
515
                } else {
 
516
                        clutter_actor_hide ((ClutterActor*) self->extra_action);
 
517
                }
 
518
        }
449
519
        block5_data_unref (_data5_);
450
520
}
451
521
 
455
525
}
456
526
 
457
527
 
 
528
static void _unity_places_place_search_bar_on_extra_action_activated_unity_places_place_search_extra_action_activated (UnityPlacesPlaceSearchExtraAction* _sender, gpointer self) {
 
529
        unity_places_place_search_bar_on_extra_action_activated (self);
 
530
}
 
531
 
 
532
 
458
533
static GObject * unity_places_place_search_bar_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
459
534
        GObject * obj;
460
535
        GObjectClass * parent_class;
468
543
                UnityPlacesPlaceSearchNavigation* _tmp2_;
469
544
                UnityPlacesPlaceSearchEntry* _tmp3_;
470
545
                UnityPlacesPlaceSearchSectionsBar* _tmp4_;
471
 
                UnityPlacesPlaceSearchBarBackground* _tmp5_;
 
546
                ClutterColor _tmp5_ = {0};
 
547
                ClutterColor _tmp6_;
 
548
                ClutterRectangle* space;
 
549
                UnityPlacesPlaceSearchExtraAction* _tmp7_;
 
550
                UnityPlacesPlaceSearchBarBackground* _tmp8_;
472
551
                ctk_actor_set_padding ((CtkActor*) self, (_tmp1_ = (_tmp0_.top = UNITY_PLACES_PLACE_SEARCH_BAR_SPACING * 2.0f, _tmp0_.right = UNITY_PLACES_PLACE_SEARCH_BAR_SPACING * 1.0f, _tmp0_.bottom = UNITY_PLACES_PLACE_SEARCH_BAR_SPACING * 1.0f, _tmp0_.left = UNITY_PLACES_PLACE_SEARCH_BAR_SPACING * 1.0f, _tmp0_), &_tmp1_));
473
552
                self->priv->navigation = (_tmp2_ = g_object_ref_sink (unity_places_place_search_navigation_new ()), _g_object_unref0 (self->priv->navigation), _tmp2_);
474
553
                ctk_box_pack ((CtkBox*) self, (ClutterActor*) self->priv->navigation, FALSE, TRUE);
479
558
                g_signal_connect_object (self->entry, "text-changed", (GCallback) _unity_places_place_search_bar_on_search_text_changed_unity_places_place_search_entry_text_changed, self, 0);
480
559
                self->sections = (_tmp4_ = g_object_ref_sink (unity_places_place_search_sections_bar_new ()), _g_object_unref0 (self->sections), _tmp4_);
481
560
                ctk_box_pack ((CtkBox*) self, (ClutterActor*) self->sections, FALSE, TRUE);
482
 
                clutter_actor_show ((ClutterActor*) self->entry);
483
 
                self->priv->bg = (_tmp5_ = g_object_ref_sink (unity_places_place_search_bar_background_new (self->priv->navigation, self->entry)), _g_object_unref0 (self->priv->bg), _tmp5_);
 
561
                clutter_actor_show ((ClutterActor*) self->sections);
 
562
                space = g_object_ref_sink ((ClutterRectangle*) clutter_rectangle_new_with_color ((_tmp6_ = (_tmp5_.red = (guint8) 255, _tmp5_.green = (guint8) 255, _tmp5_.blue = (guint8) 255, _tmp5_.alpha = (guint8) 0, _tmp5_), &_tmp6_)));
 
563
                ctk_box_pack ((CtkBox*) self, (ClutterActor*) space, TRUE, TRUE);
 
564
                clutter_actor_show ((ClutterActor*) space);
 
565
                self->extra_action = (_tmp7_ = g_object_ref_sink (unity_places_place_search_extra_action_new ()), _g_object_unref0 (self->extra_action), _tmp7_);
 
566
                ctk_box_pack ((CtkBox*) self, (ClutterActor*) self->extra_action, FALSE, TRUE);
 
567
                clutter_actor_hide ((ClutterActor*) self->extra_action);
 
568
                g_signal_connect_object (self->extra_action, "activated", (GCallback) _unity_places_place_search_bar_on_extra_action_activated_unity_places_place_search_extra_action_activated, self, 0);
 
569
                self->priv->bg = (_tmp8_ = g_object_ref_sink (unity_places_place_search_bar_background_new (self->priv->navigation, self->entry)), _g_object_unref0 (self->priv->bg), _tmp8_);
484
570
                ctk_actor_set_background ((CtkActor*) self, (ClutterActor*) self->priv->bg);
485
571
                clutter_actor_show ((ClutterActor*) self->priv->bg);
 
572
                _g_object_unref0 (space);
486
573
        }
487
574
        return obj;
488
575
}
512
599
        _g_object_unref0 (self->priv->navigation);
513
600
        _g_object_unref0 (self->entry);
514
601
        _g_object_unref0 (self->sections);
 
602
        _g_object_unref0 (self->extra_action);
515
603
        G_OBJECT_CLASS (unity_places_place_search_bar_parent_class)->finalize (obj);
516
604
}
517
605
 
744
832
                        e = _inner_error_;
745
833
                        _inner_error_ = NULL;
746
834
                        {
747
 
                                g_warning ("places-place-search-bar.vala:200: Unable to load dash background");
 
835
                                g_warning ("places-place-search-bar.vala:247: Unable to load dash background");
748
836
                                _g_error_free0 (e);
749
837
                        }
750
838
                }