MnpClockArea * mnp_clock_area_new (void) { MnpClockArea *area = g_object_new(MNP_TYPE_CLOCK_AREA, NULL); int clk_sec = 60 - (time(NULL)%60); GConfClient *client = gconf_client_get_default (); area->priv = g_new0(MnpClockAreaPriv, 1); area->priv->is_enabled = 1; area->priv->prop_sec_zero = FALSE; area->priv->clock_tiles = g_ptr_array_new (); area->priv->position = 0.05; mx_box_layout_set_orientation ((MxBoxLayout *)area, MX_ORIENTATION_VERTICAL); mx_box_layout_set_enable_animations ((MxBoxLayout *)area, TRUE); area->priv->time_now = time(NULL); area->priv->last_time = area->priv->time_now - 60 + clk_sec; mx_box_layout_set_spacing ((MxBoxLayout *)area, 4); if (clk_sec) { area->priv->source = g_timeout_add (clk_sec * 1000, (GSourceFunc)clock_ticks, area); } else { area->priv->prop_sec_zero = TRUE; area->priv->source = g_timeout_add (60 * 1000, (GSourceFunc)clock_ticks, area); } gconf_client_add_dir (client, "/apps/date-time-panel", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); gconf_client_notify_add (client, "/apps/date-time-panel/24_h_clock", clock_fmt_changed, area, NULL, NULL); area->priv->tfh = gconf_client_get_bool (client, "/apps/date-time-panel/24_h_clock", NULL); g_object_unref(client); return area; }
static void mpd_devices_tile_init (MpdDevicesTile *self) { MpdDevicesTilePrivate *priv = GET_PRIVATE (self); ClutterActor *tile; GList *mounts; priv->tiles = g_hash_table_new (g_direct_hash, g_direct_equal); priv->vbox = mx_box_layout_new (); mx_box_layout_set_enable_animations (MX_BOX_LAYOUT (priv->vbox), TRUE); mx_box_layout_set_orientation (MX_BOX_LAYOUT (priv->vbox), MX_ORIENTATION_VERTICAL); clutter_container_add_actor (CLUTTER_CONTAINER (self), priv->vbox); tile = mpd_default_device_tile_new (); clutter_container_add_actor (CLUTTER_CONTAINER (priv->vbox), tile); priv->monitor = g_volume_monitor_get (); g_signal_connect (priv->monitor, "mount-added", G_CALLBACK (_monitor_mount_added_cb), self); g_signal_connect (priv->monitor, "mount-changed", G_CALLBACK (_monitor_mount_changed_cb), self); g_signal_connect (priv->monitor, "mount-removed", G_CALLBACK (_monitor_mount_removed_cb), self); mounts = g_volume_monitor_get_mounts (priv->monitor); g_list_foreach (mounts, (GFunc) _add_mount_cb, self); g_list_free (mounts); }
static gboolean key_release_cb (ClutterActor *actor, ClutterKeyEvent *event, MxBoxLayout *box) { if (event->keyval == 'v') { mx_box_layout_set_orientation (box, !mx_box_layout_get_orientation (box)); } if (event->keyval == '=') { add_actor ((ClutterContainer*) box); } if (event->keyval == '-') { ClutterActor *child = NULL; clutter_container_foreach (CLUTTER_CONTAINER (box), (ClutterCallback) find_last_child, &child); if (child) clutter_container_remove_actor (CLUTTER_CONTAINER (box), child); } if (event->keyval == 'c') { gboolean clip; g_object_get (actor, "clip-to-allocation", &clip, NULL); g_object_set (actor, "clip-to-allocation", !clip, NULL); } if (event->keyval == 's') { guint spacing; spacing = mx_box_layout_get_spacing (box); if (spacing > 6) spacing = 0; else spacing++; mx_box_layout_set_spacing (box, spacing); } if (event->keyval == 'e') { if (hover_actor) { gboolean expand; clutter_container_child_get ((ClutterContainer*) box, hover_actor, "expand", &expand, NULL); clutter_container_child_set ((ClutterContainer*) box, hover_actor, "expand", !expand, NULL); } } if (event->keyval == 'a') { mx_box_layout_set_enable_animations (box, !mx_box_layout_get_enable_animations (box)); } return FALSE; }
static void dawati_bt_shell_init (DawatiBtShell *shell) { ClutterActor *label, *active_label, *active_box, *settings_button; DawatiBtShellPrivate *priv = GET_PRIVATE (shell); priv->devices = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); priv->requests = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); priv->notification = notify_notification_new ("", NULL, icon); notify_notification_set_timeout (priv->notification, NOTIFY_EXPIRES_NEVER); /* TRANSLATORS: button in a notification, will open the * bluetooth panel */ notify_notification_add_action (priv->notification, "show", _("Show"), (NotifyActionCallback)_notify_action_cb, shell, NULL); mx_box_layout_set_orientation (MX_BOX_LAYOUT (shell), MX_ORIENTATION_VERTICAL); label = mx_label_new_with_text (_("Bluetooth")); mx_stylable_set_style_class (MX_STYLABLE (label), "titleBar"); mx_box_layout_insert_actor_with_properties (MX_BOX_LAYOUT (shell), label, -1, "expand", TRUE, "x-fill", TRUE, "x-align", MX_ALIGN_START, NULL); priv->content = mx_box_layout_new (); clutter_actor_set_name (priv->content, "bt-panel-content"); mx_box_layout_set_enable_animations (MX_BOX_LAYOUT (priv->content), TRUE); mx_box_layout_set_orientation (MX_BOX_LAYOUT (priv->content), MX_ORIENTATION_VERTICAL); mx_box_layout_insert_actor (MX_BOX_LAYOUT (shell), priv->content, -1); active_box = mx_box_layout_new (); clutter_actor_set_name (active_box, "bt-panel-active-box"); mx_box_layout_insert_actor (MX_BOX_LAYOUT (priv->content), active_box, -1); /* TRANSLATORS: Label for bluetooth enable/disable toggle */ active_label = mx_label_new_with_text (_("Active")); mx_stylable_set_style_class (MX_STYLABLE (active_label), "BtTitle"); mx_box_layout_insert_actor_with_properties (MX_BOX_LAYOUT (active_box), active_label, -1, "expand", TRUE, "x-fill", TRUE, "x-align", MX_ALIGN_START, "y-fill", FALSE, "y-align", MX_ALIGN_MIDDLE, NULL); priv->kill_toggle = mx_toggle_new (); priv->kill_handler = g_signal_connect (priv->kill_toggle, "notify::active", G_CALLBACK (_toggle_active_cb), shell); mx_box_layout_insert_actor (MX_BOX_LAYOUT (active_box), priv->kill_toggle, -1); /* devices that are requesting something go here */ priv->request_box = mx_box_layout_new (); mx_box_layout_set_orientation (MX_BOX_LAYOUT (priv->request_box), MX_ORIENTATION_VERTICAL); mx_box_layout_set_enable_animations (MX_BOX_LAYOUT (priv->request_box), TRUE); mx_box_layout_insert_actor (MX_BOX_LAYOUT (priv->content), priv->request_box, -1); /* connected devices go here */ priv->device_panelbox = g_object_ref (mx_box_layout_new ()); mx_box_layout_set_orientation (MX_BOX_LAYOUT (priv->device_panelbox), MX_ORIENTATION_VERTICAL); mx_stylable_set_style_class (MX_STYLABLE (priv->device_panelbox), "contentPanel"); priv->info_label = mx_label_new_with_text (_("Nothing connected")); mx_stylable_set_style_class (MX_STYLABLE (priv->info_label), "BtTitle"); clutter_actor_hide (priv->info_label); mx_box_layout_insert_actor (MX_BOX_LAYOUT (priv->device_panelbox), priv->info_label, -1); priv->device_box = mx_box_layout_new (); mx_box_layout_set_orientation (MX_BOX_LAYOUT (priv->device_box), MX_ORIENTATION_VERTICAL); mx_box_layout_set_enable_animations (MX_BOX_LAYOUT (priv->device_box), TRUE); mx_box_layout_insert_actor (MX_BOX_LAYOUT (priv->device_panelbox), priv->device_box, -1); /* button row */ priv->button_box = mx_box_layout_new (); clutter_actor_set_name (priv->button_box, "bt-panel-button-box"); mx_box_layout_set_enable_animations (MX_BOX_LAYOUT (priv->button_box), TRUE); mx_box_layout_insert_actor_with_properties (MX_BOX_LAYOUT (priv->content), priv->button_box, -1, "expand", TRUE, "x-fill", TRUE, NULL); mx_box_layout_insert_actor_with_properties (MX_BOX_LAYOUT (priv->button_box), mx_box_layout_new (), 0, "expand", TRUE, NULL); priv->send_button = mx_button_new_with_label (_("Send file")); g_signal_connect (priv->send_button, "clicked", G_CALLBACK (_send_clicked_cb), shell); mx_box_layout_insert_actor (MX_BOX_LAYOUT (priv->button_box), priv->send_button, 1); priv->add_button = mx_button_new_with_label (_("Add new")); g_signal_connect (priv->add_button, "clicked", G_CALLBACK (_add_clicked_cb), shell); mx_box_layout_insert_actor (MX_BOX_LAYOUT (priv->button_box), priv->add_button, 2); settings_button = mx_button_new_with_label (_("Settings")); g_signal_connect (settings_button, "clicked", G_CALLBACK (_settings_clicked_cb), shell); mx_box_layout_insert_actor (MX_BOX_LAYOUT (priv->button_box), settings_button, 3); dawati_bt_shell_init_applet (shell); priv->cm = carrick_connman_manager_new (); g_signal_connect (priv->cm, "notify::available-technologies", G_CALLBACK (_available_techs_changed), shell); g_signal_connect (priv->cm, "notify::enabled-technologies", G_CALLBACK (_enabled_techs_changed), shell); #ifdef TEST_WITH_BOGUS_DATA g_debug ("TEST_WITH_BOGUS_DATA: Adding false devices & requests, " "and setting Bluetooth available even if connman is not there"); /* Dummies for quick testing without bluetooth devices or connman */ dawati_bt_shell_add_device (shell, "TestDeviceA", "a"); dawati_bt_shell_add_device (shell, "TestDeviceB", "b"); dawati_bt_shell_add_request (shell, "TestDeviceC", "c", DAWATI_BT_REQUEST_TYPE_PIN, NULL); dawati_bt_shell_add_request (shell, "TestDeviceD", "d", DAWATI_BT_REQUEST_TYPE_CONFIRM, "001234"); dawati_bt_shell_add_request (shell, "TestDeviceE", "e", DAWATI_BT_REQUEST_TYPE_AUTH, "0000111f-0000-1000-8000-00805f9b34fb"); priv->enabled = priv->available = TRUE; dawati_bt_shell_update (shell); #endif }
static void mnp_world_clock_construct (MnpWorldClock *world_clock) { ClutterActor *entry, *box, *stage; MxBoxLayout *table = (MxBoxLayout *)world_clock; gfloat width, height; MnpWorldClockPrivate *priv = GET_PRIVATE (world_clock); stage = priv->stage; priv->location_tile = FALSE; mx_box_layout_set_orientation ((MxBoxLayout *)world_clock, MX_ORIENTATION_VERTICAL); mx_box_layout_set_spacing ((MxBoxLayout *)world_clock, 0); clutter_actor_set_name (CLUTTER_ACTOR(world_clock), "TimePane"); construct_heading_and_top_area (world_clock); priv->completion_timeout = 0; /* Search Entry */ box = mx_box_layout_new (); mx_box_layout_set_enable_animations ((MxBoxLayout *)box, TRUE); mx_box_layout_set_orientation ((MxBoxLayout *)box, MX_ORIENTATION_HORIZONTAL); mx_box_layout_set_spacing ((MxBoxLayout *)box, 4); priv->entry_box = box; mx_stylable_set_style_class (MX_STYLABLE(box), "ZoneSearchEntryBox"); entry = mx_entry_new (); mx_stylable_set_style_class (MX_STYLABLE (entry), "ZoneSearchEntry"); priv->search_location = (MxEntry *)entry; mx_entry_set_hint_text (MX_ENTRY (entry), _("Enter a country or city")); mx_entry_set_secondary_icon_from_file (MX_ENTRY (entry), THEMEDIR"/edit-clear.png"); g_signal_connect (entry, "secondary-icon-clicked", G_CALLBACK (clear_btn_clicked_cb), world_clock); g_signal_connect (G_OBJECT (entry), "notify::text", G_CALLBACK (text_changed_cb), world_clock); clutter_actor_get_size (entry, &width, &height); clutter_actor_set_size (entry, width+10, -1); mx_box_layout_add_actor ((MxBoxLayout *)box, entry, 0); clutter_container_child_set (CLUTTER_CONTAINER (box), entry, "expand", FALSE, "y-fill", FALSE, "x-fill", FALSE, "y-align", MX_ALIGN_MIDDLE, "x-align", MX_ALIGN_START, NULL); priv->add_location = mx_button_new (); mx_button_set_label ((MxButton *)priv->add_location, _("Add")); mx_stylable_set_style_class (MX_STYLABLE(priv->add_location), "ZoneSearchEntryAddButton"); /* mx_box_layout_add_actor ((MxBoxLayout *)box, priv->add_location, 1); */ /* g_signal_connect (priv->add_location, "clicked", G_CALLBACK (add_location_clicked_cb), world_clock); */ /*clutter_container_child_set (CLUTTER_CONTAINER (box), priv->add_location, "expand", FALSE, "y-fill", FALSE, "y-align", MX_ALIGN_MIDDLE, NULL);*/ mx_box_layout_add_actor (MX_BOX_LAYOUT(priv->widget_box), box, -1); clutter_container_child_set (CLUTTER_CONTAINER (priv->widget_box), box, "expand", FALSE, "y-fill", FALSE, "x-fill", FALSE, "x-align", MX_ALIGN_START, NULL); /* Prep GeoClue */ priv->geo_position = geoclue_position_new ("org.freedesktop.Geoclue.Providers.Hostip", "/org/freedesktop/Geoclue/Providers/Hostip"); priv->geo_geocode = geoclue_geocode_new ("org.freedesktop.Geoclue.Providers.Yahoo", "/org/freedesktop/Geoclue/Providers/Yahoo"); priv->geo_reverse_geocode = geoclue_reverse_geocode_new ("org.freedesktop.Geoclue.Providers.Nominatim", "/org/freedesktop/Geoclue/Providers/Nominatim"); geoclue_position_get_position_async (priv->geo_position, mnp_wc_get_position_cb, world_clock); /* Clock Area */ priv->area = mnp_clock_area_new (); g_signal_connect (priv->area, "time-changed", G_CALLBACK(time_changed), world_clock); clutter_actor_set_size ((ClutterActor *)priv->area, 300, -1); clutter_actor_set_reactive ((ClutterActor *)priv->area, TRUE); clutter_actor_set_name ((ClutterActor *)priv->area, "WorldClockArea"); clutter_container_add_actor ((ClutterContainer *)stage, (ClutterActor *)priv->area); clutter_actor_lower_bottom ((ClutterActor *)priv->area); mx_droppable_enable ((MxDroppable *)priv->area); g_object_ref ((GObject *)priv->area); clutter_container_remove_actor ((ClutterContainer *)stage, (ClutterActor *)priv->area); mx_box_layout_add_actor ((MxBoxLayout *) table, (ClutterActor *)priv->area, -1); clutter_container_child_set (CLUTTER_CONTAINER (table), (ClutterActor *)priv->area, "expand", TRUE, "y-fill", TRUE, "x-fill", TRUE, NULL); priv->zones = mnp_load_zones (); mnp_clock_area_refresh_time (priv->area, TRUE); mnp_clock_area_set_zone_remove_cb (priv->area, (ZoneRemovedFunc) zone_removed_cb, (gpointer)world_clock); mnp_clock_area_set_zone_reordered_cb (priv->area, (ClockZoneReorderedFunc) zone_reordered_cb, (gpointer)world_clock); if (priv->zones->len) { int i=0; for (i=0; i<priv->zones->len; i++) { MnpZoneLocation *loc = (MnpZoneLocation *)priv->zones->pdata[i]; loc->local = FALSE; MnpClockTile *tile = mnp_clock_tile_new (loc, mnp_clock_area_get_time(priv->area), FALSE); mnp_clock_area_add_tile (priv->area, tile); } if (priv->zones->len >= 4) clutter_actor_hide (priv->entry_box); } /* div = clutter_texture_new_from_file (SINGLE_DIV_LINE, NULL); mx_box_layout_add_actor (MX_BOX_LAYOUT(world_clock), div, -1); */ box = mx_box_layout_new (); clutter_actor_set_name (box, "DateTimeLauncherBox"); priv->launcher_box = box; mx_box_layout_set_orientation ((MxBoxLayout *)box, MX_ORIENTATION_VERTICAL); mx_box_layout_set_spacing ((MxBoxLayout *)box, 6); priv->launcher = mx_button_new (); mx_button_set_label ((MxButton *) priv->launcher, _("Set Time & Date")); mx_stylable_set_style_class (MX_STYLABLE(priv->launcher), "DateTimeLauncherButton"); mx_box_layout_add_actor ((MxBoxLayout *)box, priv->launcher, -1); clutter_container_child_set (CLUTTER_CONTAINER (box), (ClutterActor *)priv->launcher, "expand", FALSE, "y-fill", FALSE, "x-fill", FALSE, "x-align", MX_ALIGN_END, NULL); mx_box_layout_add_actor ((MxBoxLayout *)world_clock, box, -1); }
static void mpd_storage_device_tile_init (MpdStorageDeviceTile *self) { MpdStorageDeviceTilePrivate *priv = GET_PRIVATE (self); ClutterText *text; ClutterActor *separator; mx_box_layout_set_orientation (MX_BOX_LAYOUT (self), MX_ORIENTATION_VERTICAL); mx_box_layout_set_enable_animations (MX_BOX_LAYOUT (self), true); priv->table = mx_table_new (); mx_table_set_column_spacing (MX_TABLE (priv->table), 5); mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (self), priv->table, -1, "x-fill", true, NULL); /* 0 1 2 +--------------------------+ Table 0 | | Text | Open | 1 | Icon | Progress | Eject | +------+-----------+-------+ Vbox 2 | <message> .. Import data | +--------------------------+ 3 | ======================== | +--------------------------+ */ /* * Column 0: icon */ priv->icon = clutter_texture_new (); clutter_actor_set_size (priv->icon, MPD_STORAGE_DEVICE_TILE_ICON_SIZE, MPD_STORAGE_DEVICE_TILE_ICON_SIZE); mx_table_add_actor_with_properties (MX_TABLE (priv->table), priv->icon, 0, 0, "row-span", 2, "column-span", 1, "x-align", MX_ALIGN_START, "x-expand", false, "x-fill", false, "y-align", MX_ALIGN_MIDDLE, "y-expand", false, "y-fill", false, NULL); /* * Column 1 */ /* Text */ priv->label = mx_label_new (); clutter_actor_set_width (priv->label, 200.0); text = (ClutterText *) mx_label_get_clutter_text (MX_LABEL (priv->label)); clutter_text_set_line_wrap (text, true); clutter_text_set_line_wrap_mode (text, PANGO_WRAP_WORD); clutter_text_set_single_line_mode (text, false); clutter_text_set_ellipsize (text, PANGO_ELLIPSIZE_END); mx_table_add_actor_with_properties (MX_TABLE (priv->table), priv->label, 0, 1, "x-align", MX_ALIGN_START, "x-expand", true, "x-fill", true, "y-align", MX_ALIGN_MIDDLE, "y-expand", false, "y-fill", false, NULL); /* Progress */ priv->meter = mx_progress_bar_new (); mx_table_add_actor_with_properties (MX_TABLE (priv->table), priv->meter, 1, 1, "x-align", MX_ALIGN_START, "x-expand", true, "x-fill", true, "y-align", MX_ALIGN_MIDDLE, "y-expand", false, "y-fill", false, NULL); /* * Column 2: buttons */ /* Open button */ priv->open = mx_button_new_with_label (_("Open")); g_signal_connect (priv->open, "clicked", G_CALLBACK (_open_clicked_cb), self); mx_table_add_actor_with_properties (MX_TABLE (priv->table), priv->open, 0, 2, "x-align", MX_ALIGN_END, "x-expand", false, "x-fill", true, "y-align", MX_ALIGN_END, "y-expand", false, "y-fill", false, NULL); /* Eject button */ priv->eject = mx_button_new_with_label (_("Eject")); g_signal_connect (priv->eject, "clicked", G_CALLBACK (_eject_clicked_cb), self); mx_table_add_actor_with_properties (MX_TABLE (priv->table), priv->eject, 1, 2, "x-align", MX_ALIGN_END, "x-expand", false, "x-fill", true, "y-align", MX_ALIGN_MIDDLE, "y-expand", false, "y-fill", false, NULL); /* * Row 2 */ /* Import button */ priv->import = mx_button_new (); clutter_actor_set_name (priv->import, "import"); g_signal_connect (priv->import, "clicked", G_CALLBACK (_import_clicked_cb), self); mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (self), priv->import, -1, "expand", false, "x-align", MX_ALIGN_END, "x-fill", false, NULL); /* * 4th row: separator */ /* Separator */ separator = mx_frame_new (); mx_stylable_set_style_class (MX_STYLABLE (separator), "separator"); mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (self), separator, -1, "expand", false, "x-align", MX_ALIGN_MIDDLE, "x-fill", true, "y-align", MX_ALIGN_START, "y-fill", false, NULL); }