summaryrefslogtreecommitdiff
path: root/drivemount/src/drive-button.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivemount/src/drive-button.c')
-rw-r--r--drivemount/src/drive-button.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/drivemount/src/drive-button.c b/drivemount/src/drive-button.c
index f64f38c4..d33600f0 100644
--- a/drivemount/src/drive-button.c
+++ b/drivemount/src/drive-button.c
@@ -31,6 +31,8 @@
#include <gdk/gdkkeysyms.h>
#include <gio/gdesktopappinfo.h>
+#include <libmate-desktop/mate-image-menu-item.h>
+
#include <string.h>
enum {
@@ -113,9 +115,10 @@ drive_button_new (GVolume *volume)
self = g_object_new (DRIVE_TYPE_BUTTON, NULL);
if (volume != NULL) {
drive_button_set_volume (self, volume);
- g_signal_connect (gtk_icon_theme_get_default (),
- "changed", G_CALLBACK (drive_button_theme_change),
- self);
+
+ g_signal_connect (gtk_icon_theme_get_default (), "changed",
+ G_CALLBACK (drive_button_theme_change),
+ self);
}
return (GtkWidget *)self;
@@ -129,9 +132,9 @@ drive_button_new_from_mount (GMount *mount)
self = g_object_new (DRIVE_TYPE_BUTTON, NULL);
drive_button_set_mount (self, mount);
- g_signal_connect (gtk_icon_theme_get_default (),
- "changed", G_CALLBACK (drive_button_theme_change),
- self);
+ g_signal_connect (gtk_icon_theme_get_default (), "changed",
+ G_CALLBACK (drive_button_theme_change),
+ self);
return (GtkWidget *)self;
}
@@ -382,13 +385,12 @@ drive_button_update (gpointer user_data)
g_free (color_string);
g_object_unref (settings);
- guchar red = color.red*255;
- guchar green = color.green*255;
- guchar blue = color.blue*255;
+ guchar red = (guchar) (color.red * 255.0);
+ guchar green = (guchar) (color.green * 255.0);
+ guchar blue = (guchar) (color.blue * 255.0);
- const gdouble ratio = 0.65;
- gdouble y_start = icon_height * ratio;
- gdouble x_start = icon_height * (1 + ratio);
+ int y_start = (int) (0.65 * (gdouble) icon_height);
+ int x_start = (int) (1.65 * (gdouble) icon_height);
for (y = y_start; y < icon_height; y++)
for (x = x_start - y; x < icon_width; x++)
@@ -531,14 +533,15 @@ create_menu_item (DriveButton *self,
{
GtkWidget *item, *image;
- item = gtk_image_menu_item_new_with_mnemonic (label);
+ item = mate_image_menu_item_new_with_mnemonic (label);
if (icon_name) {
image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
+ mate_image_menu_item_set_image (MATE_IMAGE_MENU_ITEM (item), image);
gtk_widget_show (image);
}
if (callback)
- g_signal_connect_object (item, "activate", callback, self,
+ g_signal_connect_object (item, "activate",
+ callback, self,
G_CONNECT_SWAPPED);
gtk_widget_set_sensitive (item, sensitive);
gtk_widget_show (item);
@@ -599,8 +602,11 @@ open_drive (DriveButton *self,
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", error->message);
else
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "Could not find Caja");
+
g_signal_connect (dialog, "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
+ G_CALLBACK (gtk_widget_destroy),
+ NULL);
+
gtk_widget_show (dialog);
g_error_free (error);
}