diff options
author | Michael Lausch <mila@src.gnome.org> | 1998-09-28 15:30:09 +0000 |
---|---|---|
committer | Michael Lausch <mila@src.gnome.org> | 1998-09-28 15:30:09 +0000 |
commit | 0cb8bab93e60894aca5e426a6c69e771c2948fb2 (patch) | |
tree | 231ba167cd3f7fcc25f0feadcc975e7436a89aef | |
parent | 8d2d54536cb4e644477a7f74406ebaeaa823145a (diff) |
Added properies dialig/saving/restoring.GNOME_0_30_PATCHES
-rw-r--r-- | fvwm-pager/.cvsignore | 2 | ||||
-rw-r--r-- | fvwm-pager/ChangeLog | 8 | ||||
-rw-r--r-- | fvwm-pager/INSTALL | 22 | ||||
-rw-r--r-- | fvwm-pager/Makefile.am | 4 | ||||
-rw-r--r-- | fvwm-pager/TODO | 7 | ||||
-rw-r--r-- | fvwm-pager/fvwm-pager.c | 69 | ||||
-rw-r--r-- | fvwm-pager/fvwm-pager.h | 28 | ||||
-rw-r--r-- | fvwm-pager/gtkpager.c | 73 | ||||
-rw-r--r-- | fvwm-pager/gtkpager.h | 22 | ||||
-rw-r--r-- | fvwm-pager/pager-win.c | 2 | ||||
-rw-r--r-- | fvwm-pager/pager-win.h | 2 | ||||
-rw-r--r-- | fvwm-pager/properties.c | 259 | ||||
-rw-r--r-- | fvwm-pager/properties.h | 44 |
13 files changed, 496 insertions, 46 deletions
diff --git a/fvwm-pager/.cvsignore b/fvwm-pager/.cvsignore index 70845e08e..c540bdf08 100644 --- a/fvwm-pager/.cvsignore +++ b/fvwm-pager/.cvsignore @@ -1 +1,3 @@ +.deps +.libs Makefile.in diff --git a/fvwm-pager/ChangeLog b/fvwm-pager/ChangeLog index 7bfee3ac5..eec22c0ab 100644 --- a/fvwm-pager/ChangeLog +++ b/fvwm-pager/ChangeLog @@ -1,3 +1,11 @@ +1998-09-28 Michael Lausch <mla@gams.at> + + * Added properties(save/restore), focus change on windows. + + * properties.h + * properties.c: new files. Properties handling. + + 1998-09-24 Nuno Ferreira <nmrf@rnl.ist.utl.pt> * .cvsignore: Added this file. diff --git a/fvwm-pager/INSTALL b/fvwm-pager/INSTALL index 670b805bd..b4c777847 100644 --- a/fvwm-pager/INSTALL +++ b/fvwm-pager/INSTALL @@ -64,23 +64,11 @@ The simplest way to compile this package is: How To Use The Pager ==================== -Compile the GnomePager and install it into the FVWM2 module -directory. Add lines to your .fvwm2rc file to configure the pager. -The only lines currently used are: -GnomePagerLabel <idx> <name> - -Compile the gnome panel with SWALLOWING enabled. You might want to -apply the swallow-patch to swallow.c so that the panel isn't -crashing when swallowing an application. - -Start the GnomePager from FVWM2 and swallow it into the panel. - -There's a bug in the pager which causes a sigsegv when the pager is -started without any windows (i suspect). Therefore it's possible that -the module crashes during the startup sequence of FVMW2. If you are -using the gnome-session program the panel will have one empty -slot. Restart the GnomePager module and it will be swallowed again. -I'm working on this. + +Information about Usage and fvwm2 configuration necessary for the +pager can be found in the file REAME, which is in the same directory +as this file. + Compilers and Options ===================== diff --git a/fvwm-pager/Makefile.am b/fvwm-pager/Makefile.am index fe6c4ac55..fcd9108cb 100644 --- a/fvwm-pager/Makefile.am +++ b/fvwm-pager/Makefile.am @@ -15,7 +15,9 @@ fvwm_pager_SOURCES = fvwm-pager.c \ gtkpager.c \ gtkpager.h \ pager-win.h \ - pager-win.c + pager-win.c \ + properties.h \ + properties.c fvwm_pager_LDADD = \ $(srcdir)/../../panel/libpanel_applet.la \ diff --git a/fvwm-pager/TODO b/fvwm-pager/TODO index 761e9576d..81f0edf84 100644 --- a/fvwm-pager/TODO +++ b/fvwm-pager/TODO @@ -5,12 +5,5 @@ Add layout change for vertical panels. Improve the look and feel. -Add window dragging like the FvwmPager offers. - -Perhaps switching from drawing area to gnome-canvas will make things -easier. - -Add configuration things (colors, borders, ....) - Check for conformance with the gnome window manager requirements. I'm sure i didn't catch all of them. diff --git a/fvwm-pager/fvwm-pager.c b/fvwm-pager/fvwm-pager.c index 644d97bfa..2250c54be 100644 --- a/fvwm-pager/fvwm-pager.c +++ b/fvwm-pager/fvwm-pager.c @@ -1,3 +1,21 @@ +/* fvwm-pager + * + * Copyright (C) 1998 Michael Lausch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ #include <stdio.h> #include <signal.h> #include <fvwm/module.h> @@ -6,6 +24,7 @@ #include <gnome.h> #include <gdk/gdkx.h> +#include "properties.h" #include "gtkpager.h" #include "applet-lib.h" @@ -20,6 +39,8 @@ static void switch_to_desktop (GtkFvwmPager* pager, int desktop_offset); static void move_window (GtkFvwmPager* pager, unsigned long xid, int desktop, int x, int y); #endif +PagerProps pager_props; + gint pager_width = 170; gint pager_height = 70; @@ -79,19 +100,22 @@ about_cb(AppletWidget* widget, gpointer data) about = gnome_about_new( _("Fvwm Pager Applet"), "0.1", - _("Copyrhight (C) 1998 M. Lausch"), + _("Copyright (C) 1998 M. Lausch"), (const gchar**)authors, "Pager for Fvwm2 window manager", 0); gtk_widget_show(about); } -void properties_dialog(AppletWidget *widget, gpointer data) +static gint +save_session (GtkWidget* widget, char* privcfgpath, + char* globcfgpath, gpointer data) { - - return; + save_fvwmpager_properties ("fvwmpager", &pager_props); + return FALSE; } + int main(int argc, char* argv[]) { @@ -104,14 +128,18 @@ main(int argc, char* argv[]) static GtkWidget* pager = 0; GList* desktops; - dummy_argv[0] = "fvwm-pager"; + + + dummy_argv[0] = "fvwmpager"; panel_corba_register_arguments(); - applet_widget_init_defaults("fvwmpager_applet", NULL, 1, dummy_argv, 0, NULL, argv[0]); + applet_widget_init_defaults("#fvwmpager", NULL, 1, dummy_argv, 0, NULL, argv[0]); window = applet_widget_new(); + load_fvwmpager_properties("fvwmpager", &pager_props); + gtk_widget_realize(window); _XA_WIN_WORKSPACE = XInternAtom(GDK_DISPLAY(), "WIN_WORKSPACE", False); @@ -149,15 +177,6 @@ main(int argc, char* argv[]) XChangeProperty(GDK_DISPLAY(), GDK_ROOT_WINDOW(), _XA_WIN_WORKSPACE_COUNT, _XA_WIN_WORKSPACE_COUNT, 32, PropModeReplace, (unsigned char*) xprop_long_data, 1); - pager_props.width = 170; - pager_props.height = 70; - pager_props.inactive_desk_color = "NavajoWhite"; - pager_props.active_desk_color = "red"; - pager_props.inactive_win_color = "lavender"; - pager_props.active_win_color = "MintCream"; - pager_props.default_cursor = ""; - pager_props.window_drag_cursor = ""; - gtk_widget_set_usize(GTK_WIDGET(window), pager_props.width, pager_props.height); pager = gtk_fvwmpager_new(fd, pager_props.width, pager_props.height); @@ -168,6 +187,10 @@ main(int argc, char* argv[]) gtk_signal_connect(GTK_OBJECT(window), "delete_event", GTK_SIGNAL_FUNC(destroy), NULL); + gtk_signal_connect(GTK_OBJECT(window), "save_session", + GTK_SIGNAL_FUNC(save_session), + NULL); + applet_widget_add(APPLET_WIDGET(window), pager); applet_widget_register_stock_callback(APPLET_WIDGET(window), @@ -180,8 +203,8 @@ main(int argc, char* argv[]) "properties", GNOME_STOCK_MENU_PROP, _("Properties"), - properties_dialog, - NULL); + pager_properties_dialog, + pager); desktops = 0; for (idx = 0; idx < ndesks; idx++) { @@ -249,6 +272,7 @@ main(int argc, char* argv[]) SendInfo(fd, "Send_WindowList", 0); applet_widget_gtk_main(); + save_fvwmpager_properties ("fvwmpager", &pager_props); return 0; } @@ -343,6 +367,15 @@ destroy_window(GtkFvwmPager* pager, unsigned long* body) } void +set_focus(GtkFvwmPager* pager, unsigned long* body) +{ + unsigned long xid; + + xid = body[0]; + gtk_fvwmpager_set_current_window(GTK_FVWMPAGER(pager), xid); +} + +void deiconify_window(GtkFvwmPager* pager, unsigned long* body) { unsigned long xid; @@ -392,7 +425,7 @@ void process_message(GtkFvwmPager* pager, unsigned long type,unsigned long *body break; case M_FOCUS_CHANGE: g_log("fvwm-pager", G_LOG_LEVEL_DEBUG, "message: unhandled M_FOCUS_CHANGE received\n"); - /* list_focus(body);*/ + set_focus(pager, body); break; case M_NEW_PAGE: g_log("fvwm-pager", G_LOG_LEVEL_DEBUG, "message: unhandled M_ADD_WINDOW received\n"); diff --git a/fvwm-pager/fvwm-pager.h b/fvwm-pager/fvwm-pager.h new file mode 100644 index 000000000..9d3eec067 --- /dev/null +++ b/fvwm-pager/fvwm-pager.h @@ -0,0 +1,28 @@ +/* fvwm-pager + * + * Copyright (C) 1998 Michael Lausch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __fvwmpager_h__ +#define __fvwmpager_h__ 1 + +#include <gnome.h> +#include <glib.h> + + + +#endif diff --git a/fvwm-pager/gtkpager.c b/fvwm-pager/gtkpager.c index 1d2b7746c..264e0a538 100644 --- a/fvwm-pager/gtkpager.c +++ b/fvwm-pager/gtkpager.c @@ -1,3 +1,21 @@ +/* fvwm-pager + * + * Copyright (C) 1998 Michael Lausch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ #include <stdio.h> #include <stdlib.h> #include <strings.h> @@ -11,6 +29,7 @@ #include "gtkpager.h" #include "pager-win.h" +#include "properties.h" #include "fvwm-pager.h" static GtkFvwmPagerClass* parent_class = NULL; @@ -377,6 +396,7 @@ gtk_fvwmpager_set_current_desk(GtkFvwmPager* pager, int desktop) pager->current_desktop = (Desktop*)g_list_nth(pager->desktops, desktop)->data; i = GNOME_CANVAS_ITEM(pager->current_desktop->dt); gnome_canvas_item_set(i, "fill_color", pager_props.active_desk_color, NULL); + } } @@ -486,6 +506,8 @@ gtk_fvwmpager_destroy_window(GtkFvwmPager* pager, gint xid) PagerWindow* window = g_hash_table_lookup(pager->windows, (gconstpointer) xid); + if (window = pager->current_window) + pager->current_window = 0; gtk_object_destroy(GTK_OBJECT(window->rect)); g_hash_table_remove(pager->windows, (gconstpointer) xid); g_free(window); @@ -515,9 +537,58 @@ gtk_fvwmpager_lower_window(GtkFvwmPager* pager, gint xid) gnome_canvas_item_lower_to_bottom(GNOME_CANVAS_ITEM(window->rect)); } - +static void +change_window_color(gpointer key, gpointer value, gpointer data) +{ + PagerWindow* win = value; + PagerWindow* cwin = data; + if (win == cwin) + { + gnome_canvas_item_set(GNOME_CANVAS_ITEM(win->rect), "fill_color", pager_props.active_win_color, NULL); + } + else + { + gnome_canvas_item_set(GNOME_CANVAS_ITEM(win->rect), "fill_color", pager_props.inactive_win_color, NULL); + } +} + +void +gtk_fvwmpager_prop_changed(GtkFvwmPager* pager) +{ + GList* desks = pager->desktops; + + while(desks) + { + Desktop* desk = desks->data; + if (desk == pager->current_desktop) + gnome_canvas_item_set(GNOME_CANVAS_ITEM(desk->dt),"fill_color", pager_props.active_desk_color, NULL); + else + gnome_canvas_item_set(GNOME_CANVAS_ITEM(desk->dt),"fill_color", pager_props.inactive_desk_color, NULL); + desks = g_list_next(desks); + } + g_hash_table_foreach(pager->windows, change_window_color, pager->current_window); +} + +void +gtk_fvwmpager_set_current_window(GtkFvwmPager* pager, gint xid) +{ + PagerWindow* window; + + window = g_hash_table_lookup(pager->windows, (gconstpointer)xid); + if (window == pager->current_window) + return; + + if (pager->current_window) + gnome_canvas_item_set(GNOME_CANVAS_ITEM(pager->current_window->rect), "fill_color", pager_props.inactive_win_color, NULL); + pager->current_window = window; + if (!window) + return; + gnome_canvas_item_set(GNOME_CANVAS_ITEM(window->rect), "fill_color", pager_props.active_win_color, NULL); +} + + void gtk_fvwmpager_label_desk(GtkFvwmPager* pager, int idx, char* label) { diff --git a/fvwm-pager/gtkpager.h b/fvwm-pager/gtkpager.h index 738b183fe..94f919b25 100644 --- a/fvwm-pager/gtkpager.h +++ b/fvwm-pager/gtkpager.h @@ -1,3 +1,21 @@ +/* fvwm-pager + * + * Copyright (C) 1998 Michael Lausch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ #ifndef __GTK_PAGER_H__ #define __GTK_PAGER_H__ 1 #include <stdio.h> @@ -67,6 +85,7 @@ struct _GtkFvwmPager int* fd; Desktop* current_desktop; + PagerWindow* current_window; }; @@ -94,6 +113,9 @@ void gtk_fvwmpager_deiconify_window (GtkFvwmPager* pager, gint xid); void gtk_fvwmpager_raise_window (GtkFvwmPager* pager, gint xid); void gtk_fvwmpager_lower_window (GtkFvwmPager* pager, gint xid); void gtk_fvwmpager_destroy_window (GtkFvwmPager* pager, gint xid); +void gtk_fvwmpager_set_current_window(GtkFvwmPager*, gint idx); +void gtk_fvwmpager_prop_changed (GtkFvwmPager* pager); + #endif diff --git a/fvwm-pager/pager-win.c b/fvwm-pager/pager-win.c index a312fc0a4..9b845a115 100644 --- a/fvwm-pager/pager-win.c +++ b/fvwm-pager/pager-win.c @@ -1,4 +1,4 @@ -/* GNOME FVWM PAger +/* fvwm-pager * Copyright (C) 1998 Michael Lausch * * This library is free software; you can redistribute it and/or diff --git a/fvwm-pager/pager-win.h b/fvwm-pager/pager-win.h index 6bc59609c..a4625b998 100644 --- a/fvwm-pager/pager-win.h +++ b/fvwm-pager/pager-win.h @@ -1,4 +1,4 @@ -/* GNOME FVWM PAger +/* fvwm-pager * Copyright (C) 1998 Michael Lausch * * This library is free software; you can redistribute it and/or diff --git a/fvwm-pager/properties.c b/fvwm-pager/properties.c new file mode 100644 index 000000000..3618632b2 --- /dev/null +++ b/fvwm-pager/properties.c @@ -0,0 +1,259 @@ + +/* fvwm-pager + * + * Copyright (C) 1998 Michael Lausch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gnome.h> +#include "gtkpager.h" +#include "properties.h" + +static GtkWidget* propbox = 0; +static PagerProps temp_props; +extern PagerProps pager_props; + +gchar confpath[1024]; + +void +load_fvwmpager_properties(gchar* path, PagerProps* prop) +{ + sprintf(confpath, "/%s/gui/", path); + gnome_config_push_prefix(confpath); + prop->active_desk_color = gnome_config_get_string("active_desk=red"); + prop->active_win_color = gnome_config_get_string("active_win=MintCream"); + prop->inactive_desk_color = gnome_config_get_string("inactive_desk=NavajoWhite"); + prop->inactive_win_color = gnome_config_get_string("inactive_win=lavender"); + prop->width = gnome_config_get_int("width=170"); + prop->height = gnome_config_get_int("height=70"); + prop->window_drag_cursor = 0; + prop->default_cursor = 0; + gnome_config_pop_prefix(); +} + + +void +save_fvwmpager_properties(gchar* path, PagerProps* props) +{ + sprintf(confpath, "/%s/gui/", path); + gnome_config_push_prefix(confpath); + gnome_config_set_string("active_desk", props->active_desk_color); + gnome_config_set_string("active_win", props->active_win_color); + gnome_config_set_string("inactive_desk", props->inactive_desk_color); + gnome_config_set_string("inactive_win", props->inactive_win_color); + gnome_config_set_int("width", props->width); + gnome_config_set_int("height", props->height); + gnome_config_pop_prefix(); + gnome_config_sync(); +} + +static void +color_changed_cb (GnomeColorPicker* widget, int r, int g, int b, int a, gchar** color) +{ + char *tmp; + + + tmp = g_malloc (24); + snprintf (tmp, 24, "#%04x%04x%04x", r, g, b); + *color = tmp; + gnome_property_box_changed (GNOME_PROPERTY_BOX(propbox)); +} + + +static void +height_cb (GtkWidget *widget, GtkWidget *spin) +{ + temp_props.height = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON(spin)); + gnome_property_box_changed (GNOME_PROPERTY_BOX(propbox)); +} + +static void +width_cb (GtkWidget *widget, GtkWidget *spin) +{ + temp_props.width = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON(spin)); + gnome_property_box_changed (GNOME_PROPERTY_BOX(propbox)); +} + +static GtkWidget * +create_properties_frame (void) +{ + GtkWidget* label; + GtkWidget* box; + GtkWidget* wcolor; + GtkWidget* dcolor; + GtkWidget* color; + GtkWidget* size; + GtkWidget* height; + GtkWidget* width; + GtkWidget* height_a; + GtkWidget* width_a; + + GtkWidget* actwin_gcs; + GtkWidget* inactwin_gcs; + GtkWidget* actdesk_gcs; + GtkWidget* inactdesk_gcs; + gint adr, adg, adb; + gint idr, idg, idb; + gint awr, awg, awb; + gint iwr, iwg, iwb; + + sscanf (temp_props.active_desk_color, "#%04x%04x%04x", &adr, &adg, &adb); + sscanf (temp_props.inactive_desk_color, "#%04x%04x%04x", &idr, &idg, &idb); + sscanf (temp_props.active_win_color, "#%04x%04x%04x", &awr, &awg, &awb); + sscanf (temp_props.inactive_win_color, "#%04x%04x%04x", &iwr, &iwg, &iwb); + + box = gtk_vbox_new (5, TRUE); + wcolor = gtk_vbox_new (5, TRUE); + dcolor = gtk_vbox_new (5, TRUE); + color = gtk_hbox_new (5, TRUE); + size = gtk_hbox_new (5, TRUE); + gtk_container_border_width (GTK_CONTAINER(box), 5); + + gtk_box_pack_start_defaults(GTK_BOX(color), dcolor); + gtk_box_pack_start_defaults(GTK_BOX(color), wcolor); + + + actwin_gcs = gnome_color_picker_new(); + gnome_color_picker_set_use_alpha(GNOME_COLOR_PICKER(actwin_gcs), 0); + gnome_color_picker_set_title(GNOME_COLOR_PICKER(actwin_gcs), _("Active Window Color")); + + inactwin_gcs = gnome_color_picker_new(); + gnome_color_picker_set_use_alpha(GNOME_COLOR_PICKER(actwin_gcs), 0); + gnome_color_picker_set_title(GNOME_COLOR_PICKER(actwin_gcs), _("Inactive Window Color")); + + actdesk_gcs = gnome_color_picker_new(); + gnome_color_picker_set_use_alpha(GNOME_COLOR_PICKER(actwin_gcs), 0); + gnome_color_picker_set_title(GNOME_COLOR_PICKER(actwin_gcs), _("Active Desktop Color")); + + inactdesk_gcs = gnome_color_picker_new(); + gnome_color_picker_set_use_alpha(GNOME_COLOR_PICKER(actwin_gcs), 0); + gnome_color_picker_set_title(GNOME_COLOR_PICKER(actwin_gcs), _("Inactive Desktop Color")); + + gnome_color_picker_set_i16 (GNOME_COLOR_PICKER(actwin_gcs), awr, awg, awb, 255); + gnome_color_picker_set_i16 (GNOME_COLOR_PICKER(inactwin_gcs), iwr, iwg, iwb, 255); + gnome_color_picker_set_i16 (GNOME_COLOR_PICKER(actdesk_gcs), adr, adg, adb, 255); + gnome_color_picker_set_i16 (GNOME_COLOR_PICKER(inactdesk_gcs),idr, idg, idb, 255); + gtk_signal_connect(GTK_OBJECT(actdesk_gcs), "color-set", + GTK_SIGNAL_FUNC(color_changed_cb), &temp_props.active_desk_color); + gtk_signal_connect(GTK_OBJECT(inactdesk_gcs), "color-set", + GTK_SIGNAL_FUNC(color_changed_cb), &temp_props.inactive_desk_color); + gtk_signal_connect(GTK_OBJECT(actwin_gcs), "color-set", + GTK_SIGNAL_FUNC(color_changed_cb), &temp_props.active_win_color); + gtk_signal_connect(GTK_OBJECT(inactwin_gcs), "color-set", + GTK_SIGNAL_FUNC(color_changed_cb), &temp_props.inactive_win_color); + + + + label = gtk_label_new (_("Active Window Color")); + gtk_box_pack_start_defaults(GTK_BOX (wcolor), label); + gtk_box_pack_start_defaults(GTK_BOX (wcolor), actwin_gcs); + + label = gtk_label_new (_("Inactive Window Color")); + gtk_box_pack_start_defaults(GTK_BOX(wcolor), label); + gtk_box_pack_start_defaults(GTK_BOX(wcolor), inactwin_gcs); + + label = gtk_label_new (_("Active Dekstop Color")); + gtk_box_pack_start_defaults(GTK_BOX (dcolor), label); + gtk_box_pack_start_defaults(GTK_BOX (dcolor), actdesk_gcs); + + label = gtk_label_new (_("Inactive Desktop Color")); + gtk_box_pack_start_defaults(GTK_BOX(dcolor), label); + gtk_box_pack_start_defaults(GTK_BOX(dcolor), inactdesk_gcs); + + label = gtk_label_new (_("Applet Height")); + height_a = gtk_adjustment_new(temp_props.height, 0.5, 128, 1, 8, 8); + height = gtk_spin_button_new(GTK_ADJUSTMENT (height_a), 1, 0); + gtk_box_pack_start_defaults(GTK_BOX (size), label); + gtk_box_pack_start_defaults(GTK_BOX (size), height); + + label = gtk_label_new (_("Width")); + width_a = gtk_adjustment_new(temp_props.width, 0.5, 128, 1, 8, 8); + width = gtk_spin_button_new(GTK_ADJUSTMENT (width_a), 1, 0); + gtk_box_pack_start_defaults(GTK_BOX (size), label); + gtk_box_pack_start_defaults(GTK_BOX (size), width); + + gtk_signal_connect (GTK_OBJECT (height_a), "value_changed", + GTK_SIGNAL_FUNC (height_cb), height); + gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (height), + GTK_UPDATE_ALWAYS); + gtk_signal_connect (GTK_OBJECT (width_a), "value_changed", + GTK_SIGNAL_FUNC (width_cb), width); + gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (width), + GTK_UPDATE_ALWAYS); + + + gtk_box_pack_start_defaults (GTK_BOX (box), color); + gtk_box_pack_start_defaults (GTK_BOX (box), size); + + gtk_widget_show_all (box); + return box; +} + +static void +apply_cb (GtkWidget *widget, gint dummy, gpointer data) +{ + + GtkFvwmPager* pager = data; + memcpy(&pager_props, &temp_props, sizeof(PagerProps)); + gtk_fvwmpager_prop_changed(pager); +} + +static gint +destroy_cb (GtkWidget *widget, gpointer data) +{ + propbox = NULL; + return FALSE; +} + + +void +pager_properties_dialog(AppletWidget *applet, gpointer data) +{ + GtkWidget* frame; + GtkWidget* label; + + if (propbox) + { + gdk_window_raise (propbox->window); + return; + } + + memcpy (&temp_props, &pager_props, sizeof (PagerProps)); + + propbox = gnome_property_box_new (); + + gtk_window_set_title + (GTK_WINDOW(&GNOME_PROPERTY_BOX(propbox)->dialog.window), + _("Fvwm Pager Settings")); + + frame = create_properties_frame(); + + label = gtk_label_new (_("General")); + gtk_widget_show (frame); + gtk_notebook_append_page + (GTK_NOTEBOOK(GNOME_PROPERTY_BOX(propbox)->notebook), + frame, label); + + gtk_signal_connect (GTK_OBJECT (propbox), "apply", + GTK_SIGNAL_FUNC (apply_cb), data); + + gtk_signal_connect (GTK_OBJECT (propbox), "destroy", + GTK_SIGNAL_FUNC (destroy_cb), data); + + gtk_widget_show_all (propbox); +} diff --git a/fvwm-pager/properties.h b/fvwm-pager/properties.h new file mode 100644 index 000000000..ec9bb79ae --- /dev/null +++ b/fvwm-pager/properties.h @@ -0,0 +1,44 @@ +/* fvwm-pager + * + * Copyright (C) 1998 Michael Lausch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __properties_h__ +#define __properties_h__ 1 + +#include <applet-widget.h> + +typedef struct _Pager_props +{ + gint width; + gint height; + gchar* active_desk_color; + gchar* inactive_desk_color; + gchar* active_win_color; + gchar* inactive_win_color; + gchar* default_cursor; + gchar* window_drag_cursor; +}PagerProps; + +extern PagerProps pager_props; + +void pager_properties_dialog(AppletWidget* applet, gpointer data); +void load_fvwmpager_properties(gchar* path, PagerProps* prop); +void save_fvwmpager_properties(gchar* path, PagerProps* prop); + + +#endif |