static gboolean _create_power_dialog (MexInfoBar *self) { MexInfoBarPrivate *priv = self->priv; ClutterActor *dialog, *dialog_label; MxAction *cancel_action, *shutdown_action; dialog = mx_dialog_new (); mx_stylable_set_style_class (MX_STYLABLE (dialog), "MexInfoBarDialog"); dialog_label = mx_label_new_with_text (_("Close Media Explorer?")); mx_stylable_set_style_class (MX_STYLABLE (dialog_label), "DialogHeader"); mx_bin_set_child (MX_BIN (dialog), dialog_label); shutdown_action = mx_action_new_full ("yes", _("Yes"), G_CALLBACK (_close_request_cb), self); cancel_action = mx_action_new_full ("no", _("No"), G_CALLBACK (_close_dialog_cb), self); mx_dialog_add_action (MX_DIALOG (dialog), shutdown_action); mx_dialog_add_action (MX_DIALOG (dialog), cancel_action); priv->power_dialog = g_object_ref (dialog); clutter_actor_show (dialog); return TRUE; }
ClutterActor * mnb_home_new_widget_dialog_new (ClutterActor *parent) { ClutterActor *dialog = g_object_new (MNB_TYPE_HOME_NEW_WIDGET_DIALOG, NULL); if (parent != NULL) mx_dialog_set_transient_parent (MX_DIALOG (dialog), parent); return dialog; }
static gboolean _show_settings_dialog_cb (ClutterActor *actor, MexInfoBar *self) { MexInfoBarPrivate *priv = self->priv; if (!priv->settings_dialog_parented) { ClutterActor *stage; stage = clutter_actor_get_stage (CLUTTER_ACTOR (self)); mx_dialog_set_transient_parent (MX_DIALOG (priv->settings_dialog), stage); priv->settings_dialog_parented = TRUE; } clutter_actor_show (priv->settings_dialog); return TRUE; }
static gboolean _create_settings_dialog (MexInfoBar *self) { MexInfoBarPrivate *priv = self->priv; ClutterActor *dialog, *network_graphic; ClutterActor *network_tile, *dialog_layout, *dialog_label; ClutterActor *network_button; MxAction *close_dialog, *network_settings; dialog = mx_dialog_new (); mx_stylable_set_style_class (MX_STYLABLE (dialog), "MexInfoBarDialog"); dialog_label = mx_label_new_with_text (_("Settings")); mx_stylable_set_style_class (MX_STYLABLE (dialog_label), "DialogHeader"); /* Create actions for settings dialog */ network_settings = _action_new_from_desktop_file ("mex-networks.desktop"); close_dialog = mx_action_new_full ("close", _("Close"), G_CALLBACK (_close_dialog_cb), self); dialog_layout = mx_table_new (); mx_table_set_column_spacing (MX_TABLE (dialog_layout), 10); mx_table_set_row_spacing (MX_TABLE (dialog_layout), 30); mx_table_insert_actor (MX_TABLE (dialog_layout), CLUTTER_ACTOR (dialog_label), 0, 0); if (network_settings) { gchar *tmp; network_graphic = mx_image_new (); mx_stylable_set_style_class (MX_STYLABLE (network_graphic), "NetworkGraphic"); tmp = g_build_filename (mex_get_data_dir (), "style", "graphic-network.png", NULL); mx_image_set_from_file (MX_IMAGE (network_graphic), tmp, NULL); g_free (tmp); network_tile = mex_tile_new (); mex_tile_set_label (MEX_TILE (network_tile), _("Network")); mex_tile_set_important (MEX_TILE (network_tile), TRUE); network_button = mx_button_new (); mx_button_set_action (MX_BUTTON (network_button), network_settings); mx_bin_set_child (MX_BIN (network_tile), network_button); mx_bin_set_child (MX_BIN (network_button), network_graphic); mx_table_insert_actor (MX_TABLE (dialog_layout), CLUTTER_ACTOR (network_tile), 1, 1); } if (!network_settings) { ClutterActor *no_settings; no_settings = mx_label_new_with_text (_("No settings helpers installed")); clutter_actor_destroy (priv->settings_button); mx_table_insert_actor (MX_TABLE (dialog_layout), CLUTTER_ACTOR (no_settings), 1, 0); } mx_bin_set_child (MX_BIN (dialog), dialog_layout); mx_dialog_add_action (MX_DIALOG (dialog), close_dialog); priv->settings_dialog = g_object_ref (dialog); return TRUE; }
static void mnb_home_new_widget_dialog_init (MnbHomeNewWidgetDialog *self) { ClutterActor *table, *itemview; MnbHomeNewWidgetDialogItemFactory *factory; MnbHomePluginsEngine *engine; const GList *l; self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, MNB_TYPE_HOME_NEW_WIDGET_DIALOG, MnbHomeNewWidgetDialogPrivate); /* set up model and view */ self->priv->items = clutter_list_model_new (ITEMS_N_COLUMNS, G_TYPE_STRING, "Module", /* ITEMS_MODULE */ G_TYPE_STRING, "Name", /* ITEMS_NAME */ G_TYPE_STRING, "Icon" /* ITEMS_ICON */); table = mx_table_new (); mx_bin_set_child (MX_BIN (self), table); factory = g_object_new (MNB_TYPE_HOME_NEW_WIDGET_DIALOG_ITEM_FACTORY, NULL); factory->dialog = self; itemview = mx_item_view_new (); mx_table_add_actor (MX_TABLE (table), itemview, 0, 1); mx_item_view_set_model (MX_ITEM_VIEW (itemview), self->priv->items); mx_item_view_set_factory (MX_ITEM_VIEW (itemview), MX_ITEM_FACTORY (factory)); mx_item_view_add_attribute (MX_ITEM_VIEW (itemview), "module", ITEMS_MODULE); mx_item_view_add_attribute (MX_ITEM_VIEW (itemview), "label", ITEMS_NAME); mx_item_view_add_attribute (MX_ITEM_VIEW (itemview), "icon", ITEMS_ICON); clutter_actor_show_all (table); /* find plugins */ /* FIXME: should we monitor for new plugins on the fly? */ engine = mnb_home_plugins_engine_dup (); for (l = peas_engine_get_plugin_list (PEAS_ENGINE (engine)); l != NULL; l = g_list_next (l)) { PeasPluginInfo *info = l->data; char *icon; if (!peas_plugin_info_is_available (info, NULL)) continue; icon = g_build_filename ( peas_plugin_info_get_module_dir (info), peas_plugin_info_get_icon_name (info), NULL); clutter_model_append (self->priv->items, ITEMS_MODULE, peas_plugin_info_get_module_name (info), ITEMS_NAME, peas_plugin_info_get_name (info), ITEMS_ICON, icon, -1); g_free (icon); } /* add actions */ mx_dialog_add_action (MX_DIALOG (self), mx_action_new_full ("cancel", _("Cancel"), G_CALLBACK (home_new_widget_dialog_cancel), self)); g_object_unref (engine); g_object_unref (factory); }