Explorar o código

Changed from gdk_color_ to gdk_rgba_ functions

Héctor García %!s(int64=11) %!d(string=hai) anos
pai
achega
ac6b0c03e0
Modificáronse 3 ficheiros con 23 adicións e 30 borrados
  1. 7 0
      ChangeLog
  2. 5 15
      src/mssh-gconf.c
  3. 11 15
      src/mssh-pref.c

+ 7 - 0
ChangeLog

@@ -1,3 +1,10 @@
+2014-01-15  Héctor García  <[email protected]>
+
+    Bumped version to 2.0 gtk3 support
+
+    Changed from gdk_color_ to gdk_rgba_ functions
+    Changed from gtk_color_button to gtk_color_chooser
+
 2014-01-15  Héctor García  <[email protected]>
 
     Bumped version to 1.3 gtk2 deprecated symbols free

+ 5 - 15
src/mssh-gconf.c

@@ -29,23 +29,18 @@ void mssh_gconf_notify_fg_colour(GConfClient *client, guint cnxn_id,
 {
     GConfValue *value;
     const gchar *colour_s;
-    GdkVisual *visual = gdk_visual_get_system();
-    GdkColormap *colour_map;
-    GdkColor colour;
+    GdkRGBA colour;
     int i;
 
     MSSHWindow *window = MSSH_WINDOW(data);
 
     value = gconf_entry_get_value(entry);
     colour_s = gconf_value_get_string(value);
-    colour_map = gdk_colormap_new(visual, TRUE);
-    gdk_colormap_alloc_color(colour_map, &colour, TRUE, TRUE);
-
-    gdk_color_parse(colour_s, &colour);
+    gdk_rgba_parse(&colour, colour_s);
 
     for(i = 0; i < window->terminals->len; i++)
     {
-        vte_terminal_set_color_foreground(VTE_TERMINAL(g_array_index(
+        vte_terminal_set_color_foreground_rgba(VTE_TERMINAL(g_array_index(
             window->terminals, MSSHTerminal*, i)), &colour);
     }
 }
@@ -55,19 +50,14 @@ void mssh_gconf_notify_bg_colour(GConfClient *client, guint cnxn_id,
 {
     GConfValue *value;
     const gchar *colour_s;
-    GdkVisual *visual = gdk_visual_get_system();
-    GdkColormap *colour_map;
-    GdkColor colour;
+    GdkRGBA colour;
     int i;
 
     MSSHWindow *window = MSSH_WINDOW(data);
 
     value = gconf_entry_get_value(entry);
     colour_s = gconf_value_get_string(value);
-    colour_map = gdk_colormap_new(visual, TRUE);
-    gdk_colormap_alloc_color(colour_map, &colour, TRUE, TRUE);
-
-    gdk_color_parse(colour_s, &colour);
+    gdk_rgba_parse(&colour, colour_s);
 
     for(i = 0; i < window->terminals->len; i++)
     {

+ 11 - 15
src/mssh-pref.c

@@ -36,13 +36,13 @@ static void mssh_pref_font_select(GtkWidget *widget, gpointer data)
 static void mssh_pref_fg_colour_select(GtkWidget *widget, gpointer data)
 {
     GConfClient *client;
-    GdkColor colour;
+    GdkRGBA colour;
     const gchar *colour_s;
 
     client = gconf_client_get_default();
 
-    gtk_color_button_get_color(GTK_COLOR_BUTTON(widget), &colour);
-    colour_s = gdk_color_to_string(&colour);
+    gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(widget), &colour);
+    colour_s = gdk_rgba_to_string(&colour);
 
     gconf_client_set_string(client, MSSH_GCONF_KEY_FG_COLOUR, colour_s,
         NULL);
@@ -51,13 +51,13 @@ static void mssh_pref_fg_colour_select(GtkWidget *widget, gpointer data)
 static void mssh_pref_bg_colour_select(GtkWidget *widget, gpointer data)
 {
     GConfClient *client;
-    GdkColor colour;
+    GdkRGBA colour;
     const gchar *colour_s;
 
     client = gconf_client_get_default();
 
-    gtk_color_button_get_color(GTK_COLOR_BUTTON(widget), &colour);
-    colour_s = gdk_color_to_string(&colour);
+    gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(widget), &colour);
+    colour_s = gdk_rgba_to_string(&colour);
 
     gconf_client_set_string(client, MSSH_GCONF_KEY_BG_COLOUR, colour_s,
         NULL);
@@ -149,9 +149,7 @@ static void mssh_pref_init(MSSHPref* pref)
     GConfClient *client;
     GConfEntry *entry;
     GConfValue *value;
-    GdkVisual *visual = gdk_visual_get_system();
-    GdkColormap *colour_map = gdk_colormap_new(visual, TRUE);
-    GdkColor colour;
+    GdkRGBA colour;
     const gchar *colour_s;
 
     GtkWidget *frame = gtk_vbox_new(FALSE, 5);
@@ -299,18 +297,16 @@ static void mssh_pref_init(MSSHPref* pref)
         TRUE, NULL);
     value = gconf_entry_get_value(entry);
     colour_s = gconf_value_get_string(value);
-    gdk_colormap_alloc_color(colour_map, &colour, TRUE, TRUE);
-    gdk_color_parse(colour_s, &colour);
-    gtk_color_button_set_color(GTK_COLOR_BUTTON(fg_colour_select),
+    gdk_rgba_parse(&colour, colour_s);
+    gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(fg_colour_select), 
         &colour);
 
     entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_BG_COLOUR, NULL,
         TRUE, NULL);
     value = gconf_entry_get_value(entry);
     colour_s = gconf_value_get_string(value);
-    gdk_colormap_alloc_color(colour_map, &colour, TRUE, TRUE);
-    gdk_color_parse(colour_s, &colour);
-    gtk_color_button_set_color(GTK_COLOR_BUTTON(bg_colour_select),
+    gdk_rgba_parse(&colour, colour_s);
+    gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(bg_colour_select),
         &colour);
 
     entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_COLUMNS, NULL,