changeset 3989:6faed0cdc276

colorize_popup is no longer in prefswin.glade
author Tomasz Mon <desowin@gmail.com>
date Sat, 24 Nov 2007 12:58:27 +0100
parents ce1ce0a6cc74
children 14c2d0729563
files src/audacious/glade/prefswin.glade src/audacious/ui_preferences.c
diffstat 2 files changed, 111 insertions(+), 257 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/glade/prefswin.glade	Fri Nov 23 23:07:04 2007 +0100
+++ b/src/audacious/glade/prefswin.glade	Sat Nov 24 12:58:27 2007 +0100
@@ -5296,241 +5296,4 @@
   </child>
 </widget>
 
-<widget class="GtkWindow" id="colorize_popup">
-  <property name="border_width">12</property>
-  <property name="title" translatable="yes">Color Adjustment</property>
-  <property name="type">GTK_WINDOW_TOPLEVEL</property>
-  <property name="window_position">GTK_WIN_POS_NONE</property>
-  <property name="modal">False</property>
-  <property name="resizable">True</property>
-  <property name="destroy_with_parent">False</property>
-  <property name="decorated">True</property>
-  <property name="skip_taskbar_hint">False</property>
-  <property name="skip_pager_hint">False</property>
-  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
-  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
-  <property name="focus_on_map">True</property>
-  <property name="urgency_hint">False</property>
-
-  <child>
-    <widget class="GtkVBox" id="vbox36">
-      <property name="visible">True</property>
-      <property name="homogeneous">False</property>
-      <property name="spacing">12</property>
-
-      <child>
-	<widget class="GtkLabel" id="label89">
-	  <property name="visible">True</property>
-	  <property name="label" translatable="yes">Audacious allows you to alter the color balance of the skinned UI. The sliders below will allow you to do this.</property>
-	  <property name="use_underline">False</property>
-	  <property name="use_markup">False</property>
-	  <property name="justify">GTK_JUSTIFY_LEFT</property>
-	  <property name="wrap">True</property>
-	  <property name="selectable">False</property>
-	  <property name="xalign">0</property>
-	  <property name="yalign">0</property>
-	  <property name="xpad">0</property>
-	  <property name="ypad">0</property>
-	  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-	  <property name="width_chars">-1</property>
-	  <property name="single_line_mode">False</property>
-	  <property name="angle">0</property>
-	</widget>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">False</property>
-	  <property name="fill">False</property>
-	</packing>
-      </child>
-
-      <child>
-	<widget class="GtkTable" id="table13">
-	  <property name="visible">True</property>
-	  <property name="n_rows">3</property>
-	  <property name="n_columns">2</property>
-	  <property name="homogeneous">False</property>
-	  <property name="row_spacing">6</property>
-	  <property name="column_spacing">12</property>
-
-	  <child>
-	    <widget class="GtkLabel" id="label94">
-	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">Blue</property>
-	      <property name="use_underline">False</property>
-	      <property name="use_markup">False</property>
-	      <property name="justify">GTK_JUSTIFY_RIGHT</property>
-	      <property name="wrap">False</property>
-	      <property name="selectable">False</property>
-	      <property name="xalign">1</property>
-	      <property name="yalign">0.5</property>
-	      <property name="xpad">0</property>
-	      <property name="ypad">0</property>
-	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-	      <property name="width_chars">-1</property>
-	      <property name="single_line_mode">False</property>
-	      <property name="angle">0</property>
-	    </widget>
-	    <packing>
-	      <property name="left_attach">0</property>
-	      <property name="right_attach">1</property>
-	      <property name="top_attach">2</property>
-	      <property name="bottom_attach">3</property>
-	      <property name="x_options"></property>
-	      <property name="y_options"></property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <widget class="GtkLabel" id="label93">
-	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">Green</property>
-	      <property name="use_underline">False</property>
-	      <property name="use_markup">False</property>
-	      <property name="justify">GTK_JUSTIFY_RIGHT</property>
-	      <property name="wrap">False</property>
-	      <property name="selectable">False</property>
-	      <property name="xalign">1</property>
-	      <property name="yalign">0.5</property>
-	      <property name="xpad">0</property>
-	      <property name="ypad">0</property>
-	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-	      <property name="width_chars">-1</property>
-	      <property name="single_line_mode">False</property>
-	      <property name="angle">0</property>
-	    </widget>
-	    <packing>
-	      <property name="left_attach">0</property>
-	      <property name="right_attach">1</property>
-	      <property name="top_attach">1</property>
-	      <property name="bottom_attach">2</property>
-	      <property name="x_options"></property>
-	      <property name="y_options"></property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <widget class="GtkLabel" id="label92">
-	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">Red</property>
-	      <property name="use_underline">False</property>
-	      <property name="use_markup">False</property>
-	      <property name="justify">GTK_JUSTIFY_RIGHT</property>
-	      <property name="wrap">False</property>
-	      <property name="selectable">False</property>
-	      <property name="xalign">1</property>
-	      <property name="yalign">0.5</property>
-	      <property name="xpad">0</property>
-	      <property name="ypad">0</property>
-	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-	      <property name="width_chars">-1</property>
-	      <property name="single_line_mode">False</property>
-	      <property name="angle">0</property>
-	    </widget>
-	    <packing>
-	      <property name="left_attach">0</property>
-	      <property name="right_attach">1</property>
-	      <property name="top_attach">0</property>
-	      <property name="bottom_attach">1</property>
-	      <property name="x_options"></property>
-	      <property name="y_options"></property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <widget class="GtkHScale" id="red_scale">
-	      <property name="visible">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="draw_value">False</property>
-	      <property name="value_pos">GTK_POS_TOP</property>
-	      <property name="digits">3</property>
-	      <property name="update_policy">GTK_UPDATE_CONTINUOUS</property>
-	      <property name="inverted">False</property>
-	      <property name="adjustment">0 0 255 0 0 0</property>
-	      <signal name="value_changed" handler="on_red_scale_value_changed"/>
-	    </widget>
-	    <packing>
-	      <property name="left_attach">1</property>
-	      <property name="right_attach">2</property>
-	      <property name="top_attach">0</property>
-	      <property name="bottom_attach">1</property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <widget class="GtkHScale" id="green_scale">
-	      <property name="visible">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="draw_value">False</property>
-	      <property name="value_pos">GTK_POS_TOP</property>
-	      <property name="digits">3</property>
-	      <property name="update_policy">GTK_UPDATE_CONTINUOUS</property>
-	      <property name="inverted">False</property>
-	      <property name="adjustment">0 0 255 0 0 0</property>
-	      <signal name="value_changed" handler="on_green_scale_value_changed"/>
-	    </widget>
-	    <packing>
-	      <property name="left_attach">1</property>
-	      <property name="right_attach">2</property>
-	      <property name="top_attach">1</property>
-	      <property name="bottom_attach">2</property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <widget class="GtkHScale" id="blue_scale">
-	      <property name="visible">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="draw_value">False</property>
-	      <property name="value_pos">GTK_POS_TOP</property>
-	      <property name="digits">3</property>
-	      <property name="update_policy">GTK_UPDATE_CONTINUOUS</property>
-	      <property name="inverted">False</property>
-	      <property name="adjustment">0 0 255 0 0 0</property>
-	      <signal name="value_changed" handler="on_blue_scale_value_changed"/>
-	    </widget>
-	    <packing>
-	      <property name="left_attach">1</property>
-	      <property name="right_attach">2</property>
-	      <property name="top_attach">2</property>
-	      <property name="bottom_attach">3</property>
-	    </packing>
-	  </child>
-	</widget>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">True</property>
-	  <property name="fill">True</property>
-	</packing>
-      </child>
-
-      <child>
-	<widget class="GtkHButtonBox" id="hbuttonbox11">
-	  <property name="visible">True</property>
-	  <property name="layout_style">GTK_BUTTONBOX_END</property>
-	  <property name="spacing">6</property>
-
-	  <child>
-	    <widget class="GtkButton" id="colorize_close">
-	      <property name="visible">True</property>
-	      <property name="can_default">True</property>
-	      <property name="has_default">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label">gtk-close</property>
-	      <property name="use_stock">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="focus_on_click">True</property>
-	      <signal name="clicked" handler="on_colorize_close_clicked"/>
-	    </widget>
-	  </child>
-	</widget>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">False</property>
-	  <property name="fill">False</property>
-	</packing>
-      </child>
-    </widget>
-  </child>
-</widget>
-
 </glade-interface>
--- a/src/audacious/ui_preferences.c	Fri Nov 23 23:07:04 2007 +0100
+++ b/src/audacious/ui_preferences.c	Sat Nov 24 12:58:27 2007 +0100
@@ -107,6 +107,11 @@
 static GtkWidget *category_notebook = NULL;
 GtkWidget *filepopupbutton = NULL;
 
+/* colorize settings scales */
+GtkWidget *green_scale;
+GtkWidget *red_scale;
+GtkWidget *blue_scale;
+
 static Category categories[] = {
     {DATA_DIR "/images/appearance.png", N_("Appearance"), 1},
     {DATA_DIR "/images/audio.png", N_("Audio"), 6},
@@ -1558,19 +1563,11 @@
 static void
 on_colorize_button_clicked(GtkButton *button, gpointer data)
 {
-	GladeXML *xml = prefswin_get_xml();
-	GtkWidget *widget;
-
-	widget = glade_xml_get_widget(xml, "red_scale");
-	gtk_range_set_value(GTK_RANGE(widget), cfg.colorize_r);
+    gtk_range_set_value(GTK_RANGE(red_scale), cfg.colorize_r);
+    gtk_range_set_value(GTK_RANGE(green_scale), cfg.colorize_g);
+    gtk_range_set_value(GTK_RANGE(blue_scale), cfg.colorize_b);
 
-	widget = glade_xml_get_widget(xml, "green_scale");
-	gtk_range_set_value(GTK_RANGE(widget), cfg.colorize_g);
-
-	widget = glade_xml_get_widget(xml, "blue_scale");
-	gtk_range_set_value(GTK_RANGE(widget), cfg.colorize_b);
-
-	gtk_widget_show(colorize_settings);
+    gtk_widget_show(colorize_settings);
 }
 
 static void
@@ -1847,15 +1844,111 @@
 
     /* colorize */
     FUNC_MAP_ENTRY(on_colorize_button_clicked)
-    FUNC_MAP_ENTRY(on_red_scale_value_changed)
-    FUNC_MAP_ENTRY(on_green_scale_value_changed)
-    FUNC_MAP_ENTRY(on_blue_scale_value_changed)
-    FUNC_MAP_ENTRY(on_colorize_close_clicked)
 
     FUNC_MAP_ENTRY(on_reload_plugins_clicked)
 FUNC_MAP_END
 
 void
+create_colorize_settings(void)
+{
+    GtkWidget *vbox;
+    GtkWidget *label;
+    GtkWidget *table;
+    GtkWidget *hbuttonbox;
+    GtkWidget *colorize_close;
+
+    GtkWidget *green_label;
+    GtkWidget *red_label;
+    GtkWidget *blue_label;
+
+    colorize_settings = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+    gtk_container_set_border_width(GTK_CONTAINER(colorize_settings), 12);
+    gtk_window_set_title(GTK_WINDOW(colorize_settings), _("Color Adjustment"));
+    gtk_window_set_type_hint(GTK_WINDOW(colorize_settings), GDK_WINDOW_TYPE_HINT_DIALOG);
+    gtk_window_set_transient_for(GTK_WINDOW(colorize_settings), GTK_WINDOW(prefswin));
+
+    vbox = gtk_vbox_new(FALSE, 12);
+    gtk_container_add(GTK_CONTAINER(colorize_settings), vbox);
+
+    label = gtk_label_new(_("Audacious allows you to alter the color balance of the skinned UI. The sliders below will allow you to do this."));
+    gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
+    gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+    gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+
+    table = gtk_table_new(3, 2, FALSE);
+    gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 0);
+    gtk_table_set_row_spacings(GTK_TABLE(table), 6);
+    gtk_table_set_col_spacings(GTK_TABLE(table), 12);
+
+    blue_label = gtk_label_new(_("Blue"));
+    gtk_table_attach(GTK_TABLE(table), blue_label, 0, 1, 2, 3,
+                     (GtkAttachOptions) (0),
+                     (GtkAttachOptions) (0), 0, 0);
+    gtk_label_set_justify(GTK_LABEL(blue_label), GTK_JUSTIFY_RIGHT);
+    gtk_misc_set_alignment(GTK_MISC(blue_label), 1, 0.5);
+
+    green_label = gtk_label_new(_("Green"));
+    gtk_table_attach(GTK_TABLE(table), green_label, 0, 1, 1, 2,
+                     (GtkAttachOptions) (0),
+                     (GtkAttachOptions) (0), 0, 0);
+    gtk_label_set_justify(GTK_LABEL(green_label), GTK_JUSTIFY_RIGHT);
+    gtk_misc_set_alignment(GTK_MISC(green_label), 1, 0.5);
+
+   red_label = gtk_label_new(_("Red"));
+   gtk_table_attach(GTK_TABLE(table), red_label, 0, 1, 0, 1,
+                    (GtkAttachOptions) (0),
+                    (GtkAttachOptions) (0), 0, 0);
+    gtk_label_set_justify(GTK_LABEL(red_label), GTK_JUSTIFY_RIGHT);
+    gtk_misc_set_alignment(GTK_MISC(red_label), 1, 0.5);
+
+    red_scale = gtk_hscale_new(GTK_ADJUSTMENT(gtk_adjustment_new(0, 0, 255, 0, 0, 0)));
+    gtk_table_attach(GTK_TABLE(table), red_scale, 1, 2, 0, 1,
+                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
+    gtk_scale_set_draw_value(GTK_SCALE(red_scale), FALSE);
+    gtk_scale_set_digits(GTK_SCALE(red_scale), 3);
+
+    green_scale = gtk_hscale_new(GTK_ADJUSTMENT(gtk_adjustment_new(0, 0, 255, 0, 0, 0)));
+    gtk_table_attach(GTK_TABLE(table), green_scale, 1, 2, 1, 2,
+                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
+    gtk_scale_set_draw_value(GTK_SCALE(green_scale), FALSE);
+    gtk_scale_set_digits(GTK_SCALE(green_scale), 3);
+
+    blue_scale = gtk_hscale_new(GTK_ADJUSTMENT(gtk_adjustment_new(0, 0, 255, 0, 0, 0)));
+    gtk_table_attach(GTK_TABLE(table), blue_scale, 1, 2, 2, 3,
+                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
+    gtk_scale_set_draw_value(GTK_SCALE(blue_scale), FALSE);
+    gtk_scale_set_digits(GTK_SCALE(blue_scale), 3);
+
+    hbuttonbox = gtk_hbutton_box_new();
+    gtk_box_pack_start(GTK_BOX(vbox), hbuttonbox, FALSE, FALSE, 0);
+    gtk_button_box_set_layout(GTK_BUTTON_BOX(hbuttonbox), GTK_BUTTONBOX_END);
+    gtk_box_set_spacing(GTK_BOX(hbuttonbox), 6);
+
+    colorize_close = gtk_button_new_from_stock("gtk-close");
+    gtk_container_add(GTK_CONTAINER(hbuttonbox), colorize_close);
+    GTK_WIDGET_SET_FLAGS(colorize_close, GTK_CAN_DEFAULT);
+
+    g_signal_connect((gpointer) red_scale, "value_changed",
+                     G_CALLBACK (on_red_scale_value_changed),
+                     NULL);
+    g_signal_connect((gpointer) green_scale, "value_changed",
+                     G_CALLBACK(on_green_scale_value_changed),
+                     NULL);
+    g_signal_connect((gpointer) blue_scale, "value_changed",
+                     G_CALLBACK(on_blue_scale_value_changed),
+                     NULL);
+    g_signal_connect((gpointer) colorize_close, "clicked",
+                     G_CALLBACK(on_colorize_close_clicked),
+                     NULL);
+
+    gtk_widget_grab_default(colorize_close);
+    gtk_widget_show_all(vbox);
+}
+
+void
 create_prefs_window(void)
 {
     const gchar *glade_file = DATA_DIR "/glade/prefswin.glade";
@@ -2095,10 +2188,8 @@
 		G_CALLBACK(on_recurse_for_cover_toggled),
 		widget);
 
-	/* Create window for color adjustment settings */
-	colorize_settings = glade_xml_get_widget(xml, "colorize_popup");
-	gtk_window_set_transient_for(GTK_WINDOW(colorize_settings), GTK_WINDOW(prefswin));
-	gtk_widget_hide(colorize_settings);
+    /* Create window for color adjustment settings */
+    create_colorize_settings();
 }
 
 void