[nautilus-actions] Only set foreground color for normal state



commit 4655888cd24965bc329aa528afd71f6a82b34eb0
Author: Pierre Wieser <pwieser trychlos org>
Date:   Mon Oct 26 21:54:40 2009 +0100

    Only set foreground color for normal state

 ChangeLog                                |    8 +++++++
 src/nact/nact-iaction-tab.c              |    9 +++----
 src/nact/nact-icommand-tab.c             |   12 ++++++----
 src/nact/nact-main-tab.c                 |   31 ++++++++++++++++++++++++++++++
 src/nact/nact-main-tab.h                 |    3 +-
 src/nact/nautilus-actions-config-tool.ui |    1 +
 6 files changed, 53 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0280b0e..53380df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2009-10-26 Pierre Wieser <pwieser trychlos org>
 
+	* src/nact/nact-iaction-tab.c (set_label_label):
+	* src/nact/nact-icommand-tab.c (set_label_label):
+	Only set color foreground for the normal state.
+
+	* src/nact/nact-main-tab.c:
+	* src/nact/nact-main-tab.h (nact_main_tab_is_page_enabled):
+	New function.
+
 	* src/nact/nautilus-actions-config-tool.ui:
 	Add mnemonics to target radio button labels.
 
diff --git a/src/nact/nact-iaction-tab.c b/src/nact/nact-iaction-tab.c
index 2224853..70860d6 100644
--- a/src/nact/nact-iaction-tab.c
+++ b/src/nact/nact-iaction-tab.c
@@ -574,15 +574,14 @@ on_label_changed( GtkEntry *entry, NactIActionTab *instance )
 }
 
 static void
-set_label_label( NactIActionTab *instance, const gchar *color )
+set_label_label( NactIActionTab *instance, const gchar *color_str )
 {
 	GtkWidget *label;
-	gchar *text;
+	GdkColor color;
 
 	label = base_window_get_widget( BASE_WINDOW( instance ), "ActionMenuLabelLabel" );
-	/* i18n: label in front of the GtkEntry where user enters the action label */
-	text = g_markup_printf_escaped( "<span color=\"%s\">%s</span>", color, _( "_Menu label :" ));
-	gtk_label_set_markup_with_mnemonic( GTK_LABEL( label ), text );
+	gdk_color_parse( color_str, &color );
+	gtk_widget_modify_fg( label, GTK_STATE_NORMAL, &color );
 }
 
 static void
diff --git a/src/nact/nact-icommand-tab.c b/src/nact/nact-icommand-tab.c
index 4a682be..44723d0 100644
--- a/src/nact/nact-icommand-tab.c
+++ b/src/nact/nact-icommand-tab.c
@@ -775,12 +775,14 @@ parse_parameters( NactICommandTab *instance )
 }
 
 static void
-set_label_label( NactICommandTab *instance, const gchar *color )
+set_label_label( NactICommandTab *instance, const gchar *color_str )
 {
-	GtkWidget *label = base_window_get_widget( BASE_WINDOW( instance ), "ProfileLabelLabel" );
-	/* i18n: label in front of the GtkEntry where user enters the profile label */
-	gchar *text = g_markup_printf_escaped( "<span color=\"%s\">%s</span>", color, _( "_Label :" ));
-	gtk_label_set_markup_with_mnemonic( GTK_LABEL( label ), text );
+	GtkWidget *label;
+	GdkColor color;
+
+	label = base_window_get_widget( BASE_WINDOW( instance ), "ProfileLabelLabel" );
+	gdk_color_parse( color_str, &color );
+	gtk_widget_modify_fg( label, GTK_STATE_NORMAL, &color );
 }
 
 static void
diff --git a/src/nact/nact-main-tab.c b/src/nact/nact-main-tab.c
index 99db97e..d6db176 100644
--- a/src/nact/nact-main-tab.c
+++ b/src/nact/nact-main-tab.c
@@ -34,6 +34,14 @@
 
 #include "nact-main-tab.h"
 
+/**
+ * nact_main_tab_enable_page:
+ * @window: the #NactMainWindow.
+ * @num_page: the page number, starting from zero.
+ * @enabled: whether the tab should be set sensitive or not.
+ *
+ * Set the sensitivity of the tab.
+ */
 void
 nact_main_tab_enable_page( NactMainWindow *window, gint num_page, gboolean enabled )
 {
@@ -47,3 +55,26 @@ nact_main_tab_enable_page( NactMainWindow *window, gint num_page, gboolean enabl
 	label = gtk_notebook_get_tab_label( notebook, page );
 	gtk_widget_set_sensitive( label, enabled );
 }
+
+/**
+ * nact_main_tab_is_page_enabled:
+ * @window: the #NactMainWindow.
+ * @num_page: the page number, starting from zero.
+ *
+ * Returns: %TRUE if the tab is sensitive, %FALSE else.
+ */
+gboolean
+nact_main_tab_is_page_enabled( NactMainWindow *window, gint num_page )
+{
+	gboolean is_sensitive;
+	GtkNotebook *notebook;
+	GtkWidget *page;
+
+	notebook = GTK_NOTEBOOK( base_window_get_widget( BASE_WINDOW( window ), "MainNotebook" ));
+	page = gtk_notebook_get_nth_page( notebook, num_page );
+
+	is_sensitive = GTK_WIDGET_IS_SENSITIVE( page );
+	g_debug( "nact_main_tab_is_page_enabled: num_page=%d, is_sensitive=%s", num_page, is_sensitive ? "True":"False" );
+
+	return( is_sensitive );
+}
diff --git a/src/nact/nact-main-tab.h b/src/nact/nact-main-tab.h
index 56f7db3..11f9c55 100644
--- a/src/nact/nact-main-tab.h
+++ b/src/nact/nact-main-tab.h
@@ -64,7 +64,8 @@ enum {
 	TAB_ADVANCED
 };
 
-void nact_main_tab_enable_page( NactMainWindow *window, gint page, gboolean enabled );
+void     nact_main_tab_enable_page( NactMainWindow *window, gint page, gboolean enabled );
+gboolean nact_main_tab_is_page_enabled( NactMainWindow *window, gint page );
 
 G_END_DECLS
 
diff --git a/src/nact/nautilus-actions-config-tool.ui b/src/nact/nautilus-actions-config-tool.ui
index cfcb48c..32e8584 100644
--- a/src/nact/nautilus-actions-config-tool.ui
+++ b/src/nact/nautilus-actions-config-tool.ui
@@ -246,6 +246,7 @@
                                             <property name="xalign">1</property>
                                             <property name="label" translatable="yes">_Icon label :</property>
                                             <property name="use_underline">True</property>
+                                            <property name="mnemonic_widget">ActionIconLabelEntry</property>
                                           </object>
                                           <packing>
                                             <property name="top_attach">2</property>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]