New MCS dialog won't work with plenty of plugins
Brian J. Tarricone
bjt23 at cornell.edu
Mon Jul 19 22:28:55 CEST 2004
the new dialog _could_ be made to scroll if necessary, similar to the
old one, but it would be nice if the threshold for doing so was set a
bit higher such that it would only scroll if you _really_ run out of
screen space.
-b
On Mon, 19 Jul 2004, Olivier wrote:
> Jasper,
>
> I'm not sure that such a design is a good thing, I mean the dialog will
> grow as much as we have new items, it's really not handy for those with
> smaller screens.
>
> I mean, yes, maybe nice now, but it's not gonna scale with the number of
> mcs plugins....
>
> So I'm not against such a achange, bit I I'm too happy with the current
> implementation, unless you prove me wrong ;)
>
> Cheers,
> Olivier.
>
>
> On Thu, 2004-07-15 at 11:53, Jasper Huysmans wrote:
> > Update of /var/cvs/xfce/xfce4/xfce-mcs-manager/xfce-mcs-manager
> > In directory dbguin.lunar-linux.org:/tmp/cvs-serv15890
> >
> > Modified Files:
> > xfce-mcs-dialog.c
> > Log Message:
> > I really do prefer this dialog design.
> >
> > Index: xfce-mcs-dialog.c
> > ===================================================================
> > RCS file: /var/cvs/xfce/xfce4/xfce-mcs-manager/xfce-mcs-manager/xfce-mcs-dialog.c,v
> > retrieving revision 1.21
> > retrieving revision 1.22
> > diff -u -d -r1.21 -r1.22
> > --- xfce-mcs-dialog.c 14 Jun 2004 18:44:27 -0000 1.21
> > +++ xfce-mcs-dialog.c 15 Jul 2004 09:53:04 -0000 1.22
> > @@ -36,6 +36,8 @@
> > #include <unistd.h>
> > #endif
> >
> > +#include <math.h>
> > +
> > #include <glib.h>
> > #include <gdk/gdkx.h>
> > #include <gmodule.h>
> > @@ -74,26 +76,97 @@
> >
> > static int plugincmp (McsPlugin *a, McsPlugin *b)
> > {
> > - if (!a || !b || !(a->caption) || !(b->caption))
> > + if (!a || !b || !(a->plugin_name) || !(b->plugin_name))
> > return -1;
> >
> > - return strcmp (a->caption, b->caption);
> > + return strcmp(a->plugin_name, b->plugin_name);
> > }
> >
> > -void run_manager_dialog (GSList *plugin_list)
> > +static GtkWidget *
> > +create_settings_button (GdkPixbuf *pb, const char *text)
> > {
> > - GSList *sorted_list, *li;
> > - GtkWidget *dlg, *vbox1, *scroll, *hbox, *vbox2, *vbox3, *button, *header;
> > + GtkWidget *button, *vbox, *image, *label;
> > +
> > + g_return_val_if_fail (text != NULL, NULL);
> > +
> > + button = gtk_button_new ();
> > + gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
> > +
> > + vbox = gtk_vbox_new (FALSE, 0);
> > + gtk_widget_show (vbox);
> > + gtk_container_add (GTK_CONTAINER (button), vbox);
> > +
> > + if (pb && (image = gtk_image_new_from_pixbuf (pb)))
> > + {
> > + gtk_widget_show (image);
> > + gtk_box_pack_start (GTK_BOX (vbox), image, TRUE, TRUE, 0);
> > + }
> > +
> > + label = gtk_label_new (text);
> > + gtk_widget_show (label);
> > + gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
> > + gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
> > +
> > + return button;
> > +}
> > +
> > +static GtkWidget *
> > +create_settings_table (GSList *plugins)
> > +{
> > + int n, rows, columns, i, j;
> > + GSList *li = plugins;
> > + GtkWidget *table, *button;
> > McsPlugin *plugin;
> > +
> > + n = g_slist_length (plugins);
> > +
> > + columns = sqrt (n);
> > + rows = n / columns;
> > +
> > + if (n % columns)
> > + rows += 1;
> > +
> > + table = gtk_table_new (rows, columns, TRUE);
> > + gtk_table_set_row_spacings (GTK_TABLE (table), 6);
> > +
> > + for (i = 0; i < rows; ++i)
> > + {
> > + for (j = 0; j < columns; ++j)
> > + {
> > + plugin = li->data;
> > +
> > + button = create_settings_button (plugin->icon, plugin->caption);
> > + gtk_widget_show (button);
> > +
> > + g_signal_connect(button, "clicked",
> > + G_CALLBACK(run_plugin_dialog), plugin);
> > +
> > + gtk_table_attach_defaults (GTK_TABLE (table), button,
> > + j, j+1, i, i+1);
> > +
> > + li = li->next;
> > +
> > + if (!li)
> > + goto out;
> > + }
> > + }
> > +
> > +out:
> > + return table;
> > +}
> > +
> > +void run_manager_dialog (GSList *plugin_list)
> > +{
> > + GSList *sorted_list;
> > + GtkWidget *dlg, *vbox1, *table, *header, *align;
> > GdkPixbuf *icon;
> > - int i;
> >
> > dlg = gtk_dialog_new_with_buttons (_("Xfce Settings Manager"), NULL,
> > GTK_DIALOG_NO_SEPARATOR,
> > - GTK_STOCK_CLOSE, GTK_RESPONSE_OK,
> > + GTK_STOCK_CLOSE, GTK_RESPONSE_OK,
> > NULL);
> >
> > - icon = xfce_themed_icon_load ("xfce4-settings", 48);
> > + icon = xfce_themed_icon_load ("xfce4-settings", 32);
> > gtk_window_set_icon (GTK_WINDOW (dlg), icon);
> >
> > vbox1 = GTK_DIALOG (dlg)->vbox;
> > @@ -103,65 +176,25 @@
> > gtk_box_pack_start (GTK_BOX (vbox1), header, FALSE, TRUE, 0);
> > g_object_unref (icon);
> >
> > - /* scroll window */
> > - scroll = gtk_scrolled_window_new(NULL, NULL);
> > - gtk_container_set_border_width(GTK_CONTAINER(scroll), BORDER);
> > -
> > - /*
> > - I made this 'ALWAYS', because gtk draws an empty space anyway ...
> > - Note: I try automatic, just to see...
> > - */
> > - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(scroll),
> > - GTK_POLICY_NEVER,
> > - GTK_POLICY_AUTOMATIC);
> > -
> > - gtk_box_pack_start (GTK_BOX (vbox1), scroll, TRUE, TRUE, 0);
> > - gtk_widget_show (scroll);
> > -
> > - hbox = gtk_hbox_new (FALSE, BORDER);
> > - gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);
> > - gtk_widget_show (hbox);
> > - gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scroll), hbox);
> > -
> > - vbox2 = gtk_vbox_new (FALSE, 0);
> > - gtk_widget_show (vbox2);
> > - gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, FALSE, 0);
> > -
> > - vbox3 = gtk_vbox_new (FALSE, 0);
> > - gtk_widget_show (vbox3);
> > - gtk_box_pack_start (GTK_BOX (hbox), vbox3, FALSE, FALSE, 0);
> > -
> > /* buttons */
> > - sorted_list = g_slist_copy (plugin_list);
> > - sorted_list = g_slist_sort (sorted_list, (GCompareFunc) plugincmp);
> > -
> > - for (i = 0, li = sorted_list; li; i++, li = li->next)
> > - {
> > - plugin = (McsPlugin *) li->data;
> > -
> > - button = xfce_menubutton_new_with_pixbuf (plugin->caption,
> > - plugin->icon);
> > - gtk_widget_set_size_request (button, -1, SETTINGS_MANAGER_ICON_SIZE);
> > - gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
> > - gtk_widget_show (button);
> > -
> > - if ((i + 1) % 2 == 1)
> > - gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
> > - else
> > - gtk_box_pack_start (GTK_BOX (vbox3), button, FALSE, FALSE, 0);
> > -
> > - g_signal_connect (button, "clicked",
> > - G_CALLBACK (run_plugin_dialog), plugin);
> > - }
> > + sorted_list = g_slist_copy(plugin_list);
> > + sorted_list = g_slist_sort(sorted_list, (GCompareFunc) plugincmp);
> > +
> > + table = create_settings_table (sorted_list);
> > + gtk_widget_show (table);
> > + gtk_box_pack_start(GTK_BOX(vbox1), table, TRUE, TRUE, 0);
> >
> > g_slist_free (sorted_list);
> >
> > - gtk_widget_set_size_request(dlg, -1, 400);
> > -
> > - g_signal_connect_swapped (dlg, "response",
> > - G_CALLBACK (close_dialog), dlg);
> > - g_signal_connect_swapped (dlg, "delete-event",
> > - G_CALLBACK (close_dialog), dlg);
> > + align = gtk_alignment_new (0,0,0,0);
> > + gtk_widget_set_size_request (align, 6, 6);
> > + gtk_widget_show (align);
> > + gtk_box_pack_start(GTK_BOX(vbox1), align, FALSE, FALSE, 0);
> > +
> > + g_signal_connect_swapped(dlg, "response",
> > + G_CALLBACK(close_dialog), dlg);
> > + g_signal_connect_swapped(dlg, "delete-event",
> > + G_CALLBACK(close_dialog), dlg);
> >
> > xfce_gtk_window_center_on_monitor_with_pointer (GTK_WINDOW (dlg));
> > gtk_widget_show (dlg);
> >
> > _______________________________________________
> > Xfce4-commits mailing list
> > Xfce4-commits at xfce.org
> > http://lunar-linux.org/mailman/listinfo/xfce4-commits
>
More information about the Xfce4-dev
mailing list