static void interesting_folder_bar_response_cb (GtkInfoBar *infobar, gint response_id, gpointer user_data) { NemoInterestingFolderBar *bar; GFile *f = NULL; bar = NEMO_INTERESTING_FOLDER_BAR (infobar); switch (response_id) { case INTERESTING_FOLDER_BAR_ACTION_OPEN_DOC: f = g_file_new_for_path ("/usr/share/nemo/actions/sample.nemo_action"); if (g_file_query_exists (f, NULL)) nemo_view_activate_file (bar->priv->view, nemo_file_get (f), NEMO_WINDOW_OPEN_FLAG_NEW_WINDOW); g_object_unref (f); break; case INTERESTING_FOLDER_BAR_SCRIPT_OPEN_DOC: f = g_file_new_for_path ("/usr/share/nemo/script-info.md"); if (g_file_query_exists (f, NULL)) nemo_view_activate_file (bar->priv->view, nemo_file_get (f), NEMO_WINDOW_OPEN_FLAG_NEW_WINDOW); g_object_unref (f); break; default: break; } }
static void nemo_interesting_folder_bar_constructed (GObject *obj) { G_OBJECT_CLASS (nemo_interesting_folder_bar_parent_class)->constructed (obj); NemoInterestingFolderBar *bar = NEMO_INTERESTING_FOLDER_BAR (obj); GtkWidget *content_area, *action_area, *w; GtkWidget *label; content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (bar)); action_area = gtk_info_bar_get_action_area (GTK_INFO_BAR (bar)); gtk_orientable_set_orientation (GTK_ORIENTABLE (action_area), GTK_ORIENTATION_HORIZONTAL); switch (bar->priv->type) { case TYPE_ACTIONS_FOLDER: label = gtk_label_new (_("Actions: Action files can be added to this folder and will appear in the menu.")); w = gtk_info_bar_add_button (GTK_INFO_BAR (bar), _("More info"), INTERESTING_FOLDER_BAR_ACTION_OPEN_DOC); gtk_widget_set_tooltip_text (w, _("View a sample action file with documentation")); break; case TYPE_SCRIPTS_FOLDER: label = gtk_label_new (_("Scripts: All executable files in this folder will appear in the " "Scripts menu.")); w = gtk_info_bar_add_button (GTK_INFO_BAR (bar), _("More info"), INTERESTING_FOLDER_BAR_SCRIPT_OPEN_DOC); gtk_widget_set_tooltip_text (w, _("View additional information about creating scripts")); break; case TYPE_NONE_FOLDER: default: label = gtk_label_new ("undefined"); break; } gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_style_context_add_class (gtk_widget_get_style_context (label), "nemo-cluebar-label"); gtk_widget_show (label); gtk_container_add (GTK_CONTAINER (content_area), label); g_signal_connect (bar, "response", G_CALLBACK (interesting_folder_bar_response_cb), bar); }
static void nemo_interesting_folder_bar_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { NemoInterestingFolderBar *bar; bar = NEMO_INTERESTING_FOLDER_BAR (object); switch (prop_id) { case PROP_VIEW: bar->priv->view = g_value_get_object (value); break; case PROP_TYPE: bar->priv->type = g_value_get_int (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }