[SCM] wavbreaker/master: debian/patches/03-save_restore_mainwnd_position.patch
alessio at users.alioth.debian.org
alessio at users.alioth.debian.org
Tue May 17 22:43:21 UTC 2011
The following commit has been merged in the master branch:
commit b381fb6730b39c705f2abdb521f871d553bdd721
Author: Alessio Treglia <alessio at debian.org>
Date: Wed May 18 00:43:09 2011 +0200
debian/patches/03-save_restore_mainwnd_position.patch
Save and restore main window position.
diff --git a/debian/patches/03-save_restore_mainwnd_position.patch b/debian/patches/03-save_restore_mainwnd_position.patch
new file mode 100644
index 0000000..654105c
--- /dev/null
+++ b/debian/patches/03-save_restore_mainwnd_position.patch
@@ -0,0 +1,142 @@
+Description: Save and restore main window position.
+Origin: upstream, commit:295
+Applied-Upstream:
+ http://wavbreaker.svn.sf.net/viewvc/wavbreaker?view=revision&revision=295
+---
+ src/appconfig.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ src/appconfig.h | 4 +++
+ src/wavbreaker.c | 12 ++++++++++-
+ 3 files changed, 71 insertions(+), 1 deletion(-)
+
+--- wavbreaker.orig/src/appconfig.c
++++ wavbreaker/src/appconfig.c
+@@ -114,6 +114,8 @@ static GtkWidget *etree_cd_length_entry
+ static char *config_filename = NULL;
+
+ /* Window and pane sizes. */
++static int main_window_xpos = -1;
++static int main_window_ypos = -1;
+ static int main_window_width = -1;
+ static int main_window_height = -1;
+ static int vpane1_position = -1;
+@@ -343,6 +345,26 @@ char *audio_options_get_output_device()
+ return "";
+ }
+
++int appconfig_get_main_window_xpos()
++{
++ return main_window_xpos;
++}
++
++void appconfig_set_main_window_xpos(int x)
++{
++ main_window_xpos = x;
++}
++
++int appconfig_get_main_window_ypos()
++{
++ return main_window_ypos;
++}
++
++void appconfig_set_main_window_ypos(int x)
++{
++ main_window_ypos = x;
++}
++
+ int appconfig_get_main_window_width()
+ {
+ return main_window_width;
+@@ -974,6 +996,16 @@ static int appconfig_read_file() {
+ nkey = atoi((char *)key);
+ set_audio_function_pointers_with_index(nkey);
+ xmlFree(key);
++ } else if (!(xmlStrcmp(cur->name, (const xmlChar *) "main_window_xpos"))) {
++ key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
++ nkey = atoi((char *)key);
++ appconfig_set_main_window_xpos(nkey);
++ xmlFree(key);
++ } else if (!(xmlStrcmp(cur->name, (const xmlChar *) "main_window_ypos"))) {
++ key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
++ nkey = atoi((char *)key);
++ appconfig_set_main_window_ypos(nkey);
++ xmlFree(key);
+ } else if (!(xmlStrcmp(cur->name, (const xmlChar *) "main_window_width"))) {
+ key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+ nkey = atoi((char *)key);
+@@ -1126,6 +1158,30 @@ int appconfig_write_file() {
+ xmlFreeNodeList(root);
+ xmlFreeDoc(doc);
+ return 3;
++ }
++
++ sprintf(tmp_str, "%d", appconfig_get_main_window_xpos());
++ cur = xmlNewChild(root, NULL, (const xmlChar *)"main_window_xpos",
++ (const xmlChar *) tmp_str);
++
++ if (cur == NULL) {
++ fprintf(stderr, "error creating wavbreaker config file\n");
++ fprintf(stderr, "error creating main_window_xpos node\n");
++ xmlFreeNodeList(root);
++ xmlFreeDoc(doc);
++ return 3;
++ }
++
++ sprintf(tmp_str, "%d", appconfig_get_main_window_ypos());
++ cur = xmlNewChild(root, NULL, (const xmlChar *)"main_window_ypos",
++ (const xmlChar *) tmp_str);
++
++ if (cur == NULL) {
++ fprintf(stderr, "error creating wavbreaker config file\n");
++ fprintf(stderr, "error creating main_window_ypos node\n");
++ xmlFreeNodeList(root);
++ xmlFreeDoc(doc);
++ return 3;
+ }
+
+ cur = xmlNewChild(root, NULL, (const xmlChar *)"etree_filename_suffix",
+--- wavbreaker.orig/src/appconfig.h
++++ wavbreaker/src/appconfig.h
+@@ -43,6 +43,10 @@ int get_prepend_file_number();
+ char *get_etree_filename_suffix();
+ char *get_etree_cd_length();
+
++int appconfig_get_main_window_xpos();
++void appconfig_set_main_window_xpos(int x);
++int appconfig_get_main_window_ypos();
++void appconfig_set_main_window_ypos(int x);
+ int appconfig_get_main_window_width();
+ void appconfig_set_main_window_width(int x);
+ int appconfig_get_main_window_height();
+--- wavbreaker.orig/src/wavbreaker.c
++++ wavbreaker/src/wavbreaker.c
+@@ -2741,12 +2741,16 @@ menu_rename(gpointer callback_data, guin
+
+ static void save_window_sizes()
+ {
+- gint w, h;
++ gint x, y, w, h;
++
++ gdk_window_get_root_origin (GDK_WINDOW(main_window->window), &x, &y);
+ gtk_window_get_size(GTK_WINDOW(main_window), &w, &h);
+ /*
+ g_print("w: %d\n", w);
+ g_print("h: %d\n", h);
+ */
++ appconfig_set_main_window_xpos(x);
++ appconfig_set_main_window_ypos(y);
+ appconfig_set_main_window_width(w);
+ appconfig_set_main_window_height(h);
+ appconfig_set_vpane1_position(gtk_paned_get_position(GTK_PANED(vpane1)));
+@@ -3239,6 +3243,12 @@ int main(int argc, char **argv)
+
+ sample_init();
+
++ if (appconfig_get_main_window_xpos() > 0) {
++ gtk_window_move (GTK_WINDOW (main_window),
++ appconfig_get_main_window_xpos(),
++ appconfig_get_main_window_ypos());
++ }
++
+ if( appconfig_get_main_window_width() > 0) {
+ gtk_window_resize(GTK_WINDOW(main_window),
+ appconfig_get_main_window_width(),
diff --git a/debian/patches/series b/debian/patches/series
index 586e799..e8afcfd 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
01-spanish_translation.patch
02-gtk_deprecated_calls.patch
+03-save_restore_mainwnd_position.patch
--
wavbreaker packaging
More information about the pkg-multimedia-commits
mailing list