67
67
typedef struct _UnityPlacesPlaceSearchSectionsBar UnityPlacesPlaceSearchSectionsBar;
68
68
typedef struct _UnityPlacesPlaceSearchSectionsBarClass UnityPlacesPlaceSearchSectionsBarClass;
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))
77
typedef struct _UnityPlacesPlaceSearchExtraAction UnityPlacesPlaceSearchExtraAction;
78
typedef struct _UnityPlacesPlaceSearchExtraActionClass UnityPlacesPlaceSearchExtraActionClass;
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)))
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;
134
148
struct _UnityPlacesPlaceSearchBarClass {
200
214
CtkBoxClass parent_class;
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;
203
224
struct _Block5Data {
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);
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), ".", "");
432
case UNITY_PLACES_ACTIVATION_STATUS_ACTIVATED_SHOW_DASH:
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:
440
unity_shell_hide_unity (unity_global_shell);
445
g_warning ("places-place-search-bar.vala:159: Unexpected activation status: %u", (guint) _result_);
395
453
static gpointer _g_object_ref0 (gpointer self) {
396
454
return self ? g_object_ref (self) : NULL;
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;
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);
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) {
510
if ((_tmp2_ = (_tmp1_ = (char*) gee_abstract_map_get ((GeeAbstractMap*) unity_places_place_entry_get_hints (entry), "UnityExtraAction")) != NULL, _g_free0 (_tmp1_), _tmp2_)) {
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"));
514
clutter_actor_show ((ClutterActor*) self->extra_action);
516
clutter_actor_hide ((ClutterActor*) self->extra_action);
449
519
block5_data_unref (_data5_);
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);
458
533
static GObject * unity_places_place_search_bar_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
460
535
GObjectClass * parent_class;
468
543
UnityPlacesPlaceSearchNavigation* _tmp2_;
469
544
UnityPlacesPlaceSearchEntry* _tmp3_;
470
545
UnityPlacesPlaceSearchSectionsBar* _tmp4_;
471
UnityPlacesPlaceSearchBarBackground* _tmp5_;
546
ClutterColor _tmp5_ = {0};
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);
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);