Previously, the Preferences dialog would come up the title 'Layer Properties', 
which is obviously wrong.
Hence this patch allows the creator of the dialog to set the name.
So, now it says 'Preferences' for the preferences dialog and then for actual 
layer dialogs the old name is maintained.

Git diff attached.

Be Seeing You - Rob.
If at first you don't succeed,
then skydiving isn't for you.

                                          
_________________________________________________________________
http://clk.atdmt.com/UKM/go/195013117/direct/01/
diff --git a/src/acquire.c b/src/acquire.c
index 77e31b0..5e62bef 100644
--- a/src/acquire.c
+++ b/src/acquire.c
@@ -257,7 +257,7 @@ static void acquire ( VikWindow *vw, VikLayersPanel *vlp, VikViewport *vvp, VikD
   }
   /* POSSIBILITY 2: UI BUILDER */
   else if ( source_interface->params ) {
-    paramdatas = a_uibuilder_run_dialog ( GTK_WINDOW(vw),
+    paramdatas = a_uibuilder_run_dialog ( source_interface->window_title, GTK_WINDOW(vw),
 			source_interface->params, source_interface->params_count,
 			source_interface->params_groups, source_interface->params_groups_count,
 			source_interface->params_defaults );
diff --git a/src/preferences.c b/src/preferences.c
index 5b723c7..0316233 100644
--- a/src/preferences.c
+++ b/src/preferences.c
@@ -257,7 +257,7 @@ void a_preferences_show_window(GtkWindow *parent) {
     }
     loaded = TRUE;
     preferences_load_from_file();
-    if ( a_uibuilder_properties_factory ( parent, contiguous_params, params_count,
+    if ( a_uibuilder_properties_factory ( _("Preferences"), parent, contiguous_params, params_count,
 				(gchar **) groups_names->pdata, groups_names->len, // groups, groups_count, // groups? what groups?!
                                 (gboolean (*) (gpointer,guint16,VikLayerParamData,gpointer)) preferences_run_setparam,
 				NULL /* not used */, contiguous_params,
diff --git a/src/uibuilder.c b/src/uibuilder.c
index 81c6898..bb0ee4c 100644
--- a/src/uibuilder.c
+++ b/src/uibuilder.c
@@ -251,7 +251,7 @@ VikLayerParamData a_uibuilder_widget_get_value ( GtkWidget *widget, VikLayerPara
 }
 
 
-gint a_uibuilder_properties_factory ( GtkWindow *parent, VikLayerParam *params,
+gint a_uibuilder_properties_factory ( const gchar *dialog_name, GtkWindow *parent, VikLayerParam *params,
 			guint16 params_count, gchar **groups, guint8 groups_count,
 			gboolean (*setparam) (gpointer,guint16,VikLayerParamData,gpointer),
 			gpointer pass_along1, gpointer pass_along2,
@@ -274,11 +274,11 @@ gint a_uibuilder_properties_factory ( GtkWindow *parent, VikLayerParam *params,
   else
   {
     /* create widgets and titles; place in table */
-    GtkWidget *dialog = gtk_dialog_new_with_buttons ( "Layer Properties",
-                            parent,
-                            GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-                            GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
-                            GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL );
+    GtkWidget *dialog = gtk_dialog_new_with_buttons ( dialog_name,
+						      parent,
+						      GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+						      GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
+						      GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL );
     gint resp;
 
 
@@ -381,12 +381,13 @@ static VikLayerParamData uibuilder_run_getparam ( VikLayerParamData *params_defa
 }
 
 
-VikLayerParamData *a_uibuilder_run_dialog ( GtkWindow *parent, VikLayerParam *params,
+VikLayerParamData *a_uibuilder_run_dialog (  const gchar *dialog_name, GtkWindow *parent, VikLayerParam *params,
                         guint16 params_count, gchar **groups, guint8 groups_count,
                         VikLayerParamData *params_defaults )
 {
     VikLayerParamData *paramdatas = g_new(VikLayerParamData, params_count);
-    if ( a_uibuilder_properties_factory ( parent, 
+    if ( a_uibuilder_properties_factory ( dialog_name,
+					  parent,
 					  params, 
 					  params_count, 
 					  groups, 
diff --git a/src/uibuilder.h b/src/uibuilder.h
index b9669c4..24c28b3 100644
--- a/src/uibuilder.h
+++ b/src/uibuilder.h
@@ -95,7 +95,7 @@ VIK_LAYER_PARAM_STRING_LIST,
 
 GtkWidget *a_uibuilder_new_widget ( VikLayerParam *param, VikLayerParamData data );
 VikLayerParamData a_uibuilder_widget_get_value ( GtkWidget *widget, VikLayerParam *param );
-gint a_uibuilder_properties_factory ( GtkWindow *parent, VikLayerParam *params,
+gint a_uibuilder_properties_factory ( const gchar *dialog_name, GtkWindow *parent, VikLayerParam *params,
                         guint16 params_count, gchar **groups, guint8 groups_count,
                         gboolean (*setparam) (gpointer,guint16,VikLayerParamData,gpointer),
                         gpointer pass_along1, gpointer pass_along2,
@@ -104,7 +104,7 @@ gint a_uibuilder_properties_factory ( GtkWindow *parent, VikLayerParam *params,
                                 /* pass_along1 and pass_along2 are for set_param first and last params */
 
 
-VikLayerParamData *a_uibuilder_run_dialog ( GtkWindow *parent, VikLayerParam *params,
+VikLayerParamData *a_uibuilder_run_dialog ( const gchar *dialog_name, GtkWindow *parent, VikLayerParam *params,
                         guint16 params_count, gchar **groups, guint8 groups_count,
 			VikLayerParamData *params_defaults );
 
diff --git a/src/viklayer.c b/src/viklayer.c
index ce9e04f..77ff574 100644
--- a/src/viklayer.c
+++ b/src/viklayer.c
@@ -460,7 +460,8 @@ void vik_layer_post_read ( VikLayer *layer, VikViewport *vp, gboolean from_file
 
 static gboolean layer_properties_factory ( VikLayer *vl, VikViewport *vp )
 {
-  switch ( a_uibuilder_properties_factory ( VIK_GTK_WINDOW_FROM_WIDGET(vp),
+  switch ( a_uibuilder_properties_factory ( _("Layer Properties"),
+					    VIK_GTK_WINDOW_FROM_WIDGET(vp),
 					    vik_layer_interfaces[vl->type]->params,
 					    vik_layer_interfaces[vl->type]->params_count,
 					    vik_layer_interfaces[vl->type]->params_groups,
------------------------------------------------------------------------------
_______________________________________________
Viking-devel mailing list
Viking-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viking-devel
Viking home page: http://viking.sf.net/

Reply via email to