[mednaffe] 18/99: Added an option to remember window size.Now it let resize down to 768x516. Fix issue 2

Stephen Kitt skitt at moszumanska.debian.org
Tue Aug 2 21:00:01 UTC 2016


This is an automated email from the git hooks/post-receive script.

skitt pushed a commit to branch master
in repository mednaffe.

commit cf10785e5d07265937f1c5ed788433e3e6f0def0
Author: amatcoder <amatcoder at 44025b82-9115-564b-7d03-7f3fc60b4744>
Date:   Sun Oct 6 16:45:00 2013 +0000

    Added an option to remember window size.Now it let resize down to 768x516. Fix issue 2
---
 src/mednaffe.c       | 64 +++++++++++++++++++++++++++++++++++------
 src/mednaffe_glade.h | 81 ++++++++++++++++++++++++++++++++++------------------
 src/toggles.c        |  2 ++
 3 files changed, 111 insertions(+), 36 deletions(-)

diff --git a/src/mednaffe.c b/src/mednaffe.c
index 2d813f1..eb94145 100644
--- a/src/mednaffe.c
+++ b/src/mednaffe.c
@@ -137,10 +137,11 @@ void game_selected(GtkTreeSelection *treeselection, guidata *gui)
     g_free(selected);
   }
 }
+
 #ifdef G_OS_WIN32
 G_MODULE_EXPORT
 #endif
-void quit(GObject *object, guidata *gui)
+void quit(GtkWidget *widget, guidata *gui)
 {
   GtkTreeIter iter;
   GtkTreeModel *combostore;
@@ -192,7 +193,23 @@ void quit(GObject *object, guidata *gui)
   option = GTK_WIDGET(gtk_builder_get_object(gui->builder,"showtooltips"));         
   g_key_file_set_boolean(key_file, "GUI", "Tooltips",
                          gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(option)));
-  
+                         
+  option = GTK_WIDGET(gtk_builder_get_object(gui->builder,"remembersize"));                         
+  g_key_file_set_boolean(key_file, "GUI", "RememberSize",
+                         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(option))); 
+  if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(option))) 
+    {
+	  gint width;
+	  gint height;
+	  
+	  gtk_window_get_size(GTK_WINDOW(gui->topwindow), &width, &height);
+	  if (width && height)
+	  {
+	    g_key_file_set_integer(key_file, "GUI", "Width", width);                   
+        g_key_file_set_integer(key_file, "GUI", "Height", height);
+	  }
+	} 
+	                     
   g_key_file_set_integer(key_file, "GUI", "Filter", gui->filter);                   
   g_key_file_set_integer(key_file, "GUI", "View Mode", gui->listmode);                     
   g_key_file_set_integer(key_file, "GUI", "ActionLaunch", gui->state);
@@ -293,9 +310,7 @@ void load_conf(guidata *gui)
         gtk_list_store_set(combostore, &iter, 0, folders[n_items], -1);
       }
     }
-    option = GTK_WIDGET(gtk_builder_get_object(gui->builder,
-                                               "showtooltips"));
-                                               
+                                        
     value = g_key_file_get_boolean(key_file, "GUI", "Reverse Sort", &err);
     
      if (err==NULL)
@@ -308,9 +323,10 @@ void load_conf(guidata *gui)
       g_error_free (err);
       err=NULL;
     }
-      
-    value = g_key_file_get_boolean(key_file, "GUI", "Tooltips", &err);
-        
+    
+    option = GTK_WIDGET(gtk_builder_get_object(gui->builder,
+                                               "showtooltips"));      
+    value = g_key_file_get_boolean(key_file, "GUI", "Tooltips", &err);    
     if (err==NULL)
       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(option),value);
     else
@@ -318,7 +334,29 @@ void load_conf(guidata *gui)
       g_error_free (err);
       err=NULL;
     }
-
+    
+    option = GTK_WIDGET(gtk_builder_get_object(gui->builder,
+                                               "remembersize"));    
+    value = g_key_file_get_boolean(key_file, "GUI", "RememberSize", &err); 
+    if (err==NULL)
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(option),value);
+    else
+    {
+      g_error_free (err);
+      err=NULL;
+    }
+    if (value)
+    {
+	  gint width;
+	  gint height;
+	  
+	  width = g_key_file_get_integer(key_file, "GUI", "Width", NULL);
+	  height = g_key_file_get_integer(key_file, "GUI", "Height", NULL);
+	  
+	  if (width && height)
+	    gtk_window_resize(GTK_WINDOW(gui->topwindow), width, height);
+	}
+    
     option = GTK_WIDGET(gtk_builder_get_object(gui->builder,
                                                "recursivemenuitem"));
     value = g_key_file_get_integer(key_file, "GUI", "Recursive", &err);
@@ -410,6 +448,14 @@ void load_conf(guidata *gui)
     gtk_combo_box_set_active(GTK_COMBO_BOX(gui->cbpath), a_item);
 }
 
+#ifdef G_OS_WIN32
+G_MODULE_EXPORT
+#endif
+void delete(GtkWidget *widget, GdkEvent *event, guidata *gui)
+{
+  quit(widget,gui);
+}
+
 gchar *get_cfg(const gchar *home)
 {
   gchar *cfg_path = NULL;
diff --git a/src/mednaffe_glade.h b/src/mednaffe_glade.h
index c9c877c..77c0376 100644
--- a/src/mednaffe_glade.h
+++ b/src/mednaffe_glade.h
@@ -626,7 +626,7 @@ static const char *mednaffe_glade =
 "<property name=\"title\">Mednaffe</property>\n"
 "<property name=\"default_width\">1024</property>\n"
 "<property name=\"default_height\">768</property>\n"
-"<signal name=\"destroy\" handler=\"quit\" swapped=\"no\"/>\n"
+"<signal name=\"delete-event\" handler=\"delete\" swapped=\"no\"/>\n"
 "<child>\n"
 "<object class=\"GtkVBox\" id=\"vbox1\">\n"
 "<property name=\"visible\">True</property>\n"
@@ -1646,7 +1646,7 @@ static const char *mednaffe_glade =
 "<property name=\"can_focus\">False</property>\n"
 "<child>\n"
 "<object class=\"GtkCheckButton\" id=\"-input.joystick.global_focus\">\n"
-"<property name=\"label\" translatable=\"yes\">Update physical joystick(s) internal state in Mednafen even when Mednafen lacks OS focus</property>\n"
+"<property name=\"label\" translatable=\"yes\">Update physical joystick(s) internal state even when Mednafen lacks OS focus</property>\n"
 "<property name=\"use_action_appearance\">False</property>\n"
 "<property name=\"visible\">True</property>\n"
 "<property name=\"can_focus\">True</property>\n"
@@ -3177,6 +3177,16 @@ static const char *mednaffe_glade =
 "</packing>\n"
 "</child>\n"
 "<child>\n"
+"<object class=\"GtkScrolledWindow\" id=\"scrolledwindow1\">\n"
+"<property name=\"visible\">True</property>\n"
+"<property name=\"can_focus\">True</property>\n"
+"<property name=\"hscrollbar_policy\">automatic</property>\n"
+"<property name=\"vscrollbar_policy\">automatic</property>\n"
+"<child>\n"
+"<object class=\"GtkViewport\" id=\"viewport1\">\n"
+"<property name=\"visible\">True</property>\n"
+"<property name=\"can_focus\">False</property>\n"
+"<child>\n"
 "<object class=\"GtkNotebook\" id=\"notebook3\">\n"
 "<property name=\"visible\">True</property>\n"
 "<property name=\"can_focus\">True</property>\n"
@@ -3306,10 +3316,10 @@ static const char *mednaffe_glade =
 "Full-screen stretch as far as the aspect ratio(in this sense, the equivalent xscalefs == yscalefs) can be maintained.\n"
 "\n"
 "aspect_int - Aspect Preserve + Integer Scale\n"
-"Full-screen stretch, same as \"aspect\" except that the equivalent xscalefs and yscalefs are rounded down to the nearest integer.\n"
+"Full-screen stretch, same as 'aspect' except that the equivalent xscalefs and yscalefs are rounded down to the nearest integer.\n"
 "\n"
 "aspect_mult2 - Aspect Preserve + Integer Multiple-of-2 Scale\n"
-"Full-screen stretch, same as \"aspect_int\", but rounds down to the nearest multiple of 2.</property>\n"
+"Full-screen stretch, same as 'aspect_int', but rounds down to the nearest multiple of 2.</property>\n"
 "<property name=\"model\">cbstore_stretch</property>\n"
 "<property name=\"active\">4</property>\n"
 "<child>\n"
@@ -3355,9 +3365,7 @@ static const char *mednaffe_glade =
 "<property name=\"visible\">True</property>\n"
 "<property name=\"can_focus\">False</property>\n"
 "<property name=\"has_tooltip\">True</property>\n"
-"<property name=\"tooltip_text\" translatable=\"yes\">The destination rectangle is NOT altered by this setting, so if you have xscale and yscale set to \"2\", and try to use a 3x scaling filter like hq3x, the image is not going to look that great. \n"
-"\n"
-"The nearest-neighbor scalers are intended for use with bilinear interpolation enabled, at high resolutions (such as 1280x1024; nn2x (or nny2x) + bilinear interpolation + fullscreen stretching at this resolution looks quite nice).</property>\n"
+"<property name=\"tooltip_text\" translatable=\"yes\">The destination rectangle is NOT altered by this setting, so if you have xscale and yscale set to '2', and try to use a 3x scaling filter like hq3x, the image is not going to look that great. The nearest-neighbor scalers are intended for use with bilinear interpolation enabled, at high resolutions(such as 1280x1024; nn2x(or nny2x) + bilinear interpolation + fullscreen stretching at this resolution looks quite nice).</property>\n"
 "<property name=\"model\">cbstorespecial</property>\n"
 "<property name=\"active\">0</property>\n"
 "<child>\n"
@@ -3403,7 +3411,7 @@ static const char *mednaffe_glade =
 "<property name=\"visible\">True</property>\n"
 "<property name=\"can_focus\">False</property>\n"
 "<property name=\"has_tooltip\">True</property>\n"
-"<property name=\"tooltip_text\" translatable=\"yes\">Obviously, this will only work with the OpenGL \"Video driver\" setting, and only on cards and OpenGL implementations that support pixel shaders, otherwise you will get a black screen, or Mednafen may display an error message when starting up. \n"
+"<property name=\"tooltip_text\" translatable=\"yes\">Obviously, this will only work with the OpenGL 'video.driver' setting, and only on cards and OpenGL implementations that support pixel shaders, otherwise you will get a black screen, or Mednafen may display an error message when starting up.\n"
 "\n"
 "Bilinear interpolation is disabled with pixel shaders, and any interpolation, if present, will be noted in the description of each pixel shader.\n"
 "\n"
@@ -3413,7 +3421,7 @@ static const char *mednaffe_glade =
 "Will automatically interpolate on each axis if the corresponding effective scaling factor is not an integer.\n"
 "\n"
 "autoipsharper - Sharper Auto Interpolation\n"
-"Same as \"autoip\", but when interpolation is done, it is done in a manner that will reduce blurriness if possible.\n"
+"Same as 'autoip', but when interpolation is done, it is done in a manner that will reduce blurriness if possible.\n"
 "\n"
 "scale2x - Scale2x\n"
 "\n"
@@ -3426,9 +3434,9 @@ static const char *mednaffe_glade =
 "\n"
 "ipynotx - Linear interpolation on Y axis only.\n"
 "\n"
-"ipxnotysharper - Sharper version of \"ipxnoty\".\n"
+"ipxnotysharper - Sharper version of 'ipxnoty'.\n"
 "\n"
-"ipynotxsharper - Sharper version of \"ipynotx\".</property>\n"
+"ipynotxsharper - Sharper version of 'ipynotx'.</property>\n"
 "<property name=\"model\">cbstorepix</property>\n"
 "<property name=\"active\">0</property>\n"
 "<child>\n"
@@ -3504,8 +3512,7 @@ static const char *mednaffe_glade =
 "<property name=\"visible\">True</property>\n"
 "<property name=\"can_focus\">True</property>\n"
 "<property name=\"has_tooltip\">True</property>\n"
-"<property name=\"tooltip_text\" translatable=\"yes\">Opacity is specified in %; i.e. a value \n"
-"of \"100\" will give entirely black scanlines.</property>\n"
+"<property name=\"tooltip_text\" translatable=\"yes\">Opacity is specified in %; i.e. a value of'100' will give entirely black scanlines.</property>\n"
 "<property name=\"adjustment\">nes_adscanlines</property>\n"
 "<property name=\"round_digits\">0</property>\n"
 "<property name=\"digits\">0</property>\n"
@@ -3616,6 +3623,7 @@ static const char *mednaffe_glade =
 "<object class=\"GtkSpinButton\" id=\".tblur.accum.amount\">\n"
 "<property name=\"visible\">True</property>\n"
 "<property name=\"can_focus\">True</property>\n"
+"<property name=\"has_tooltip\">True</property>\n"
 "<property name=\"tooltip_text\" translatable=\"yes\">In percentage of accumulation buffer to mix with the current frame.</property>\n"
 "<property name=\"invisible_char\">•</property>\n"
 "<property name=\"invisible_char_set\">True</property>\n"
@@ -3753,7 +3761,7 @@ static const char *mednaffe_glade =
 "<property name=\"visible\">True</property>\n"
 "<property name=\"can_focus\">True</property>\n"
 "<property name=\"has_tooltip\">True</property>\n"
-"<property name=\"tooltip_text\" translatable=\"yes\">A value of \"0\" will cause the desktop vertical resolution to be used.</property>\n"
+"<property name=\"tooltip_text\" translatable=\"yes\">A value of '0' will cause the desktop horizontal resolution to be used.</property>\n"
 "<property name=\"invisible_char\">•</property>\n"
 "<property name=\"invisible_char_set\">True</property>\n"
 "<property name=\"primary_icon_activatable\">False</property>\n"
@@ -3776,7 +3784,7 @@ static const char *mednaffe_glade =
 "<property name=\"visible\">True</property>\n"
 "<property name=\"can_focus\">True</property>\n"
 "<property name=\"has_tooltip\">True</property>\n"
-"<property name=\"tooltip_text\" translatable=\"yes\">For this settings to have any effect, the \"stretch\" setting must be set to \"0\".</property>\n"
+"<property name=\"tooltip_text\" translatable=\"yes\">For this settings to have any effect, the 'stretch' setting must be set to '0'.</property>\n"
 "<property name=\"invisible_char\">•</property>\n"
 "<property name=\"invisible_char_set\">True</property>\n"
 "<property name=\"primary_icon_activatable\">False</property>\n"
@@ -3801,7 +3809,7 @@ static const char *mednaffe_glade =
 "<property name=\"visible\">True</property>\n"
 "<property name=\"can_focus\">True</property>\n"
 "<property name=\"has_tooltip\">True</property>\n"
-"<property name=\"tooltip_text\" translatable=\"yes\">A value of \"0\" will cause the desktop vertical resolution to be used.</property>\n"
+"<property name=\"tooltip_text\" translatable=\"yes\">A value of '0' will cause the desktop vertical resolution to be used.</property>\n"
 "<property name=\"invisible_char\">•</property>\n"
 "<property name=\"invisible_char_set\">True</property>\n"
 "<property name=\"primary_icon_activatable\">False</property>\n"
@@ -3824,7 +3832,7 @@ static const char *mednaffe_glade =
 "<property name=\"visible\">True</property>\n"
 "<property name=\"can_focus\">True</property>\n"
 "<property name=\"has_tooltip\">True</property>\n"
-"<property name=\"tooltip_text\" translatable=\"yes\">For this settings to have any effect, the \"stretch\" setting must be set to \"0\".</property>\n"
+"<property name=\"tooltip_text\" translatable=\"yes\">For this settings to have any effect, the 'stretch' setting must be set to '0'.</property>\n"
 "<property name=\"invisible_char\">•</property>\n"
 "<property name=\"invisible_char_set\">True</property>\n"
 "<property name=\"primary_icon_activatable\">False</property>\n"
@@ -3844,9 +3852,6 @@ static const char *mednaffe_glade =
 "</packing>\n"
 "</child>\n"
 "<child>\n"
-"<placeholder/>\n"
-"</child>\n"
-"<child>\n"
 "<object class=\"GtkHBox\" id=\"hbox9\">\n"
 "<property name=\"visible\">True</property>\n"
 "<property name=\"can_focus\">False</property>\n"
@@ -3873,6 +3878,9 @@ static const char *mednaffe_glade =
 "<property name=\"y_options\"/>\n"
 "</packing>\n"
 "</child>\n"
+"<child>\n"
+"<placeholder/>\n"
+"</child>\n"
 "</object>\n"
 "</child>\n"
 "</object>\n"
@@ -3981,9 +3989,6 @@ static const char *mednaffe_glade =
 "</packing>\n"
 "</child>\n"
 "<child>\n"
-"<placeholder/>\n"
-"</child>\n"
-"<child>\n"
 "<object class=\"GtkHBox\" id=\"hbox16\">\n"
 "<property name=\"visible\">True</property>\n"
 "<property name=\"can_focus\">False</property>\n"
@@ -4010,6 +4015,9 @@ static const char *mednaffe_glade =
 "<property name=\"y_options\"/>\n"
 "</packing>\n"
 "</child>\n"
+"<child>\n"
+"<placeholder/>\n"
+"</child>\n"
 "</object>\n"
 "</child>\n"
 "</object>\n"
@@ -4074,8 +4082,7 @@ static const char *mednaffe_glade =
 "<property name=\"can_focus\">True</property>\n"
 "<property name=\"receives_default\">False</property>\n"
 "<property name=\"has_tooltip\">True</property>\n"
-"<property name=\"tooltip_text\" translatable=\"yes\">NOTE: If your refresh rate isn't very close to 60.1Hz(+-0.1), \n"
-"you will need to enable \"Merge fields to ...\" setting to avoid excessive flickering.</property>\n"
+"<property name=\"tooltip_text\" translatable=\"yes\">NOTE: If your refresh rate isn't very close to 60.1Hz(+-0.1), you will need to enable the 'Merge fields to ...' setting to avoid excessive flickering.</property>\n"
 "<property name=\"draw_indicator\">True</property>\n"
 "<signal name=\"toggled\" handler=\"on_tblur_toggled\" object=\"ntscbox\" swapped=\"no\"/>\n"
 "</object>\n"
@@ -4734,6 +4741,10 @@ static const char *mednaffe_glade =
 "</packing>\n"
 "</child>\n"
 "</object>\n"
+"</child>\n"
+"</object>\n"
+"</child>\n"
+"</object>\n"
 "<packing>\n"
 "<property name=\"expand\">True</property>\n"
 "<property name=\"fill\">True</property>\n"
@@ -4772,7 +4783,6 @@ static const char *mednaffe_glade =
 "<object class=\"GtkVBox\" id=\"vbox28\">\n"
 "<property name=\"visible\">True</property>\n"
 "<property name=\"can_focus\">False</property>\n"
-"<property name=\"spacing\">4</property>\n"
 "<child>\n"
 "<object class=\"GtkCheckButton\" id=\"showtooltips\">\n"
 "<property name=\"label\" translatable=\"yes\">Show tooltips</property>\n"
@@ -4794,6 +4804,22 @@ static const char *mednaffe_glade =
 "</packing>\n"
 "</child>\n"
 "<child>\n"
+"<object class=\"GtkCheckButton\" id=\"remembersize\">\n"
+"<property name=\"label\" translatable=\"yes\">Remember window size</property>\n"
+"<property name=\"use_action_appearance\">False</property>\n"
+"<property name=\"visible\">True</property>\n"
+"<property name=\"can_focus\">True</property>\n"
+"<property name=\"receives_default\">False</property>\n"
+"<property name=\"active\">True</property>\n"
+"<property name=\"draw_indicator\">True</property>\n"
+"</object>\n"
+"<packing>\n"
+"<property name=\"expand\">False</property>\n"
+"<property name=\"fill\">True</property>\n"
+"<property name=\"position\">1</property>\n"
+"</packing>\n"
+"</child>\n"
+"<child>\n"
 "<object class=\"GtkVBox\" id=\"vbox26\">\n"
 "<property name=\"visible\">True</property>\n"
 "<property name=\"can_focus\">False</property>\n"
@@ -4886,7 +4912,8 @@ static const char *mednaffe_glade =
 "<packing>\n"
 "<property name=\"expand\">False</property>\n"
 "<property name=\"fill\">True</property>\n"
-"<property name=\"position\">1</property>\n"
+"<property name=\"padding\">12</property>\n"
+"<property name=\"position\">2</property>\n"
 "</packing>\n"
 "</child>\n"
 "</object>\n"
diff --git a/src/toggles.c b/src/toggles.c
index f0418e7..2c2464b 100644
--- a/src/toggles.c
+++ b/src/toggles.c
@@ -259,6 +259,8 @@ void set_values(GtkBuilder *builder, guidata *gui)
   list = g_slist_remove(list, gtk_builder_get_object(gui->builder,
                                                        "showtooltips"));
   list = g_slist_remove(list, gtk_builder_get_object(gui->builder,
+                                                       "remembersize"));
+  list = g_slist_remove(list, gtk_builder_get_object(gui->builder,
                                                           "rbnothing"));
   list = g_slist_remove(list, gtk_builder_get_object(gui->builder,
                                                          "rbminimize"));

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/mednaffe.git



More information about the Pkg-games-commits mailing list