[Patch] separator plugin
Andre Lerche
a.lerche at gmx.net
Wed Apr 21 21:57:09 CEST 2004
Hi!
Dunno whether it's worth a patch or not, but for me the Panel's separator plugin
is to tiny. So I created the attached patch where you can choose between the
old style and a separator with full icon size.
Andre
-------------- next part --------------
--- separator.c.orig 2004-04-21 20:49:20.292990176 +0200
+++ separator.c 2004-04-21 21:46:22.292767136 +0200
@@ -38,6 +38,7 @@
GtkWidget *align;
GtkWidget *hsep;
GtkWidget *vsep;
+ gboolean FullSize;
}
t_separator;
@@ -64,6 +65,19 @@
}
static void
+separator_eval_FullSize (t_separator *sep)
+{
+ if (sep->FullSize)
+ {
+ gtk_alignment_set(GTK_ALIGNMENT(sep->align), 0.5, 0.5, 1.0, 1.0);
+ }
+ else
+ {
+ gtk_alignment_set(GTK_ALIGNMENT(sep->align), 0.5, 0.5, 0.75, 0.75);
+ }
+}
+
+static void
separator_set_size (Control * control, int size)
{
/* define explicitly to do nothing */
@@ -108,6 +122,8 @@
separator_new (void)
{
t_separator *sep = g_new0 (t_separator, 1);
+
+ sep->FullSize = FALSE;
sep->box = gtk_event_box_new();
gtk_widget_show(sep->box);
@@ -146,6 +162,62 @@
return TRUE;
}
+static void
+separator_cb_changed (GtkToggleButton *cb, t_separator *sep)
+{
+ gboolean FullSize;
+
+ FullSize = gtk_toggle_button_get_active (cb);
+
+ sep->FullSize = FullSize;
+
+ separator_eval_FullSize(sep);
+}
+
+static void
+separator_create_options (Control *ctrl, GtkContainer *con, GtkWidget *done)
+{
+ t_separator *sep = ctrl->data;
+ GtkWidget *cb1;
+
+ cb1 = gtk_check_button_new_with_label N_("Full Size");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb1), sep->FullSize);
+ g_signal_connect (cb1, "toggled", G_CALLBACK (separator_cb_changed), sep);
+
+ gtk_container_add (GTK_CONTAINER(con), cb1);
+ gtk_widget_show (cb1);
+}
+
+static void
+separator_read_config (Control *ctrl, xmlNodePtr node)
+{
+ xmlChar *value;
+ t_separator *sep = ctrl->data;
+
+ for (node = node->children; node; node = node->next) {
+ if (xmlStrEqual(node->name, (const xmlChar *)"Separator")) {
+ if ((value = xmlGetProp(node, (const xmlChar *)"FullSize"))) {
+ sep->FullSize = atoi(value);
+ g_free(value);
+ }
+ break;
+ }
+ }
+ separator_eval_FullSize (sep);
+}
+
+static void
+separator_write_config (Control *ctrl, xmlNodePtr parent)
+{
+ t_separator *sep = ctrl->data;
+ xmlNodePtr root;
+ char value[2];
+
+ root = xmlNewTextChild(parent, NULL, "Separator", NULL);
+ g_snprintf(value, 2, "%d", sep->FullSize);
+ xmlSetProp(root, "FullSize", value);
+}
+
G_MODULE_EXPORT void
xfce_control_class_init (ControlClass * cc)
{
@@ -159,6 +231,9 @@
cc->set_size = separator_set_size;
cc->set_orientation = separator_set_orientation;
+ cc->read_config = separator_read_config;
+ cc->write_config = separator_write_config;
+ cc->create_options = separator_create_options;
}
XFCE_PLUGIN_CHECK_INIT
More information about the Xfce4-dev
mailing list