aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/menus
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/menus')
-rw-r--r--widgets/menus/gal-define-views-dialog.c55
-rw-r--r--widgets/menus/gal-define-views-model.c8
-rw-r--r--widgets/menus/gal-view-instance-save-as-dialog.c15
-rw-r--r--widgets/menus/gal-view-new-dialog.c28
4 files changed, 68 insertions, 38 deletions
diff --git a/widgets/menus/gal-define-views-dialog.c b/widgets/menus/gal-define-views-dialog.c
index 3a32dc64f6..ed0902c9b4 100644
--- a/widgets/menus/gal-define-views-dialog.c
+++ b/widgets/menus/gal-define-views-dialog.c
@@ -71,8 +71,8 @@ gal_define_views_dialog_class_init (GalDefineViewsDialogClass *klass)
g_object_class_install_property (object_class, PROP_COLLECTION,
g_param_spec_object ("collection",
- _("Collection"),
- /*_( */"XXX blurb" /*)*/,
+ "Collection",
+ NULL,
GAL_VIEW_COLLECTION_TYPE,
G_PARAM_READWRITE));
}
@@ -108,7 +108,9 @@ gdvd_button_new_dialog_callback (GtkWidget *widget, gint id, GalDefineViewsDialo
COL_GALVIEW_DATA, item,
-1);
- gal_view_edit (view, GTK_WINDOW (dialog));
+
+ if (view && GAL_VIEW_GET_CLASS (view)->edit)
+ gal_view_edit (view, GTK_WINDOW (dialog));
g_object_unref (view);
}
}
@@ -139,6 +141,9 @@ gdvd_button_modify_callback(GtkWidget *widget, GalDefineViewsDialog *dialog)
&dialog->model,
&iter)) {
gtk_tree_model_get (dialog->model, &iter, COL_GALVIEW_DATA, &item, -1);
+
+ g_return_if_fail (item && !item->built_in);
+
gal_view_edit (item->view, GTK_WINDOW (dialog));
}
}
@@ -159,6 +164,8 @@ gdvd_button_delete_callback(GtkWidget *widget, GalDefineViewsDialog *dialog)
&iter)) {
gtk_tree_model_get (dialog->model, &iter, COL_GALVIEW_DATA, &item, -1);
+ g_return_if_fail (item && !item->built_in);
+
for (row=0; row<dialog->collection->view_count; row++) {
if (item == dialog->collection->view_data[row]) {
gal_view_collection_delete_view (dialog->collection, row);
@@ -179,28 +186,25 @@ gdvd_button_delete_callback(GtkWidget *widget, GalDefineViewsDialog *dialog)
}
static void
-gdvd_cursor_changed_callback (GtkWidget *widget, GalDefineViewsDialog *dialog)
+gdvd_selection_changed_callback (GtkTreeSelection *selection, GalDefineViewsDialog *dialog)
{
GtkWidget *button;
GtkTreeIter iter;
- GalViewCollectionItem *item;
-
- if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (dialog->treeview),
- &dialog->model,
- &iter)) {
- GalViewClass *gvclass = NULL;
+ GalViewCollectionItem *item = NULL;
+ GalViewClass *gvclass = NULL;
+ if (gtk_tree_selection_get_selected (selection, &dialog->model, &iter)) {
gtk_tree_model_get (dialog->model, &iter, COL_GALVIEW_DATA, &item, -1);
- button = e_builder_get_widget (dialog->builder, "button-delete");
- gtk_widget_set_sensitive (GTK_WIDGET (button), !item->built_in);
-
- if (item->view)
+ if (item && item->view)
gvclass = GAL_VIEW_GET_CLASS (item->view);
-
- button = e_builder_get_widget (dialog->builder, "button-modify");
- gtk_widget_set_sensitive (GTK_WIDGET (button), !item->built_in && gvclass && gvclass->edit != NULL);
}
+
+ button = e_builder_get_widget (dialog->builder, "button-delete");
+ gtk_widget_set_sensitive (GTK_WIDGET (button), item && !item->built_in);
+
+ button = e_builder_get_widget (dialog->builder, "button-modify");
+ gtk_widget_set_sensitive (GTK_WIDGET (button), item && !item->built_in && gvclass && gvclass->edit != NULL);
}
static void
@@ -223,7 +227,10 @@ dialog_response (GalDefineViewsDialog *dialog, gint response_id, gpointer data)
static void
gal_define_views_dialog_init (GalDefineViewsDialog *dialog)
{
+ GtkWidget *content_area;
+ GtkWidget *parent;
GtkWidget *widget;
+ GtkTreeSelection *selection;
dialog->collection = NULL;
@@ -236,11 +243,16 @@ gal_define_views_dialog_init (GalDefineViewsDialog *dialog)
}
g_object_ref (widget);
- gtk_container_remove (GTK_CONTAINER (widget->parent), widget);
+
+ parent = gtk_widget_get_parent (widget);
+ gtk_container_remove (GTK_CONTAINER (parent), widget);
gtk_window_set_default_size (GTK_WINDOW (dialog), 360, 270);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
gtk_container_set_border_width (GTK_CONTAINER (widget), 6);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), widget, TRUE, TRUE, 0);
+
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ gtk_box_pack_start (GTK_BOX (content_area), widget, TRUE, TRUE, 0);
+
g_object_unref (widget);
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
@@ -256,9 +268,12 @@ gal_define_views_dialog_init (GalDefineViewsDialog *dialog)
gdvd_connect_signal (dialog, "button-new", "clicked", G_CALLBACK (gdvd_button_new_callback));
gdvd_connect_signal (dialog, "button-modify", "clicked", G_CALLBACK (gdvd_button_modify_callback));
gdvd_connect_signal (dialog, "button-delete", "clicked", G_CALLBACK (gdvd_button_delete_callback));
- gdvd_connect_signal (dialog, "treeview1", "cursor-changed", G_CALLBACK (gdvd_cursor_changed_callback));
g_signal_connect (dialog, "response", G_CALLBACK (dialog_response), NULL);
+ selection = gtk_tree_view_get_selection (dialog->treeview);
+ g_signal_connect (selection, "changed", G_CALLBACK (gdvd_selection_changed_callback), dialog);
+ gdvd_selection_changed_callback (selection, dialog);
+
gtk_widget_show (GTK_WIDGET (dialog));
}
diff --git a/widgets/menus/gal-define-views-model.c b/widgets/menus/gal-define-views-model.c
index e5425f7552..35a18a2484 100644
--- a/widgets/menus/gal-define-views-model.c
+++ b/widgets/menus/gal-define-views-model.c
@@ -175,15 +175,15 @@ gal_define_views_model_class_init (GalDefineViewsModelClass *klass)
g_object_class_install_property (object_class, PROP_EDITABLE,
g_param_spec_boolean ("editable",
- _("Editable"),
- /*_( */"XXX blurb" /*)*/,
+ "Editable",
+ NULL,
FALSE,
G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_COLLECTION,
g_param_spec_object ("collection",
- _("Collection"),
- /*_( */"XXX blurb" /*)*/,
+ "Collection",
+ NULL,
GAL_VIEW_COLLECTION_TYPE,
G_PARAM_READWRITE));
diff --git a/widgets/menus/gal-view-instance-save-as-dialog.c b/widgets/menus/gal-view-instance-save-as-dialog.c
index 56b6dc176b..b713f68000 100644
--- a/widgets/menus/gal-view-instance-save-as-dialog.c
+++ b/widgets/menus/gal-view-instance-save-as-dialog.c
@@ -220,8 +220,8 @@ gal_view_instance_save_as_dialog_class_init (GalViewInstanceSaveAsDialogClass *k
g_object_class_install_property (object_class, PROP_INSTANCE,
g_param_spec_object ("instance",
- _("Instance"),
- /*_( */"XXX blurb" /*)*/,
+ "Instance",
+ NULL,
GAL_VIEW_INSTANCE_TYPE,
G_PARAM_READWRITE));
}
@@ -229,6 +229,8 @@ gal_view_instance_save_as_dialog_class_init (GalViewInstanceSaveAsDialogClass *k
static void
gal_view_instance_save_as_dialog_init (GalViewInstanceSaveAsDialog *dialog)
{
+ GtkWidget *content_area;
+ GtkWidget *parent;
GtkWidget *widget;
dialog->instance = NULL;
@@ -245,11 +247,16 @@ gal_view_instance_save_as_dialog_init (GalViewInstanceSaveAsDialog *dialog)
}
g_object_ref (widget);
- gtk_container_remove (GTK_CONTAINER (widget->parent), widget);
+
+ parent = gtk_widget_get_parent (widget);
+ gtk_container_remove (GTK_CONTAINER (parent), widget);
/* TODO: add position/size saving/restoring */
gtk_window_set_default_size (GTK_WINDOW (dialog), 300, 360);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), widget, TRUE, TRUE, 0);
+
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ gtk_box_pack_start (GTK_BOX (content_area), widget, TRUE, TRUE, 0);
+
g_object_unref (widget);
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
diff --git a/widgets/menus/gal-view-new-dialog.c b/widgets/menus/gal-view-new-dialog.c
index ed5a539616..f364bf0779 100644
--- a/widgets/menus/gal-view-new-dialog.c
+++ b/widgets/menus/gal-view-new-dialog.c
@@ -57,15 +57,15 @@ gal_view_new_dialog_class_init (GalViewNewDialogClass *klass)
g_object_class_install_property (object_class, PROP_NAME,
g_param_spec_string ("name",
- _("Name"),
- /*_( */"XXX blurb" /*)*/,
+ "Name",
+ NULL,
NULL,
G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_FACTORY,
g_param_spec_object ("factory",
- _("Factory"),
- /*_( */"XXX blurb" /*)*/,
+ "Factory",
+ NULL,
GAL_TYPE_VIEW_FACTORY,
G_PARAM_READWRITE));
}
@@ -73,6 +73,8 @@ gal_view_new_dialog_class_init (GalViewNewDialogClass *klass)
static void
gal_view_new_dialog_init (GalViewNewDialog *dialog)
{
+ GtkWidget *content_area;
+ GtkWidget *parent;
GtkWidget *widget;
dialog->builder = gtk_builder_new ();
@@ -83,15 +85,21 @@ gal_view_new_dialog_init (GalViewNewDialog *dialog)
if (!widget) {
return;
}
+
g_object_ref (widget);
- gtk_container_remove (GTK_CONTAINER (widget->parent), widget);
- gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), widget, TRUE, TRUE, 0);
+
+ parent = gtk_widget_get_parent (widget);
+ gtk_container_remove (GTK_CONTAINER (parent), widget);
+
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ gtk_box_pack_start (GTK_BOX (content_area), widget, TRUE, TRUE, 0);
+
g_object_unref (widget);
- gtk_dialog_add_buttons (GTK_DIALOG (dialog),
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- NULL);
+ gtk_dialog_add_buttons (
+ GTK_DIALOG (dialog),
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
gtk_window_set_resizable (GTK_WINDOW(dialog), TRUE);
gtk_window_set_modal (GTK_WINDOW(dialog), TRUE);