dont set the pixmaps (capplet_fool_the_linker):
2001-09-07 Chema Celorio <chema@celorio.com> * mouse-properties-capplet.c (create_dialog): dont set the pixmaps (capplet_fool_the_linker): (mouse_capplet_create_image_widget): (mouse_capplet_create_image_widget_canvas): implement. This sets antialiased pixmaps for the mouse capplet. Maybe this call should in common. Closes bug #58293
This commit is contained in:
parent
a6e3b093e3
commit
fee5ad7111
3 changed files with 179 additions and 25 deletions
|
@ -95,7 +95,6 @@ apply_settings (Bonobo_ConfigDatabase db)
|
||||||
*
|
*
|
||||||
* Load the given pixmap and put it in the given widget. FIXME: Should this be in libcommon?
|
* Load the given pixmap and put it in the given widget. FIXME: Should this be in libcommon?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_pixmap_file (GtkWidget *widget, const gchar *filename)
|
set_pixmap_file (GtkWidget *widget, const gchar *filename)
|
||||||
{
|
{
|
||||||
|
@ -117,6 +116,87 @@ set_pixmap_file (GtkWidget *widget, const gchar *filename)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static GtkWidget *
|
||||||
|
mouse_capplet_create_image_widget_canvas (gchar *filename)
|
||||||
|
{
|
||||||
|
GtkWidget *canvas;
|
||||||
|
GdkPixbuf *pixbuf;
|
||||||
|
double width, height;
|
||||||
|
gchar *filename_dup;
|
||||||
|
|
||||||
|
filename_dup = g_strdup (filename);
|
||||||
|
pixbuf = gdk_pixbuf_new_from_file (filename_dup);
|
||||||
|
|
||||||
|
if (!pixbuf) {
|
||||||
|
g_warning ("Pixmap %s not found.", filename_dup);
|
||||||
|
g_free (filename_dup);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
width = gdk_pixbuf_get_width (pixbuf);
|
||||||
|
height = gdk_pixbuf_get_height (pixbuf);
|
||||||
|
|
||||||
|
canvas = gnome_canvas_new_aa();
|
||||||
|
GTK_OBJECT_UNSET_FLAGS (GTK_WIDGET (canvas), GTK_CAN_FOCUS);
|
||||||
|
gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS(canvas)),
|
||||||
|
gnome_canvas_pixbuf_get_type (),
|
||||||
|
"pixbuf", pixbuf,
|
||||||
|
NULL);
|
||||||
|
gtk_widget_set_usize (canvas, width, height);
|
||||||
|
|
||||||
|
gdk_pixbuf_unref (pixbuf);
|
||||||
|
gtk_widget_show (canvas);
|
||||||
|
g_free (filename_dup);
|
||||||
|
|
||||||
|
return canvas;
|
||||||
|
}
|
||||||
|
|
||||||
|
GtkWidget *
|
||||||
|
mouse_capplet_create_image_widget (gchar *name,
|
||||||
|
gchar *string1, gchar *string2,
|
||||||
|
gint int1, gint int2)
|
||||||
|
{
|
||||||
|
GtkWidget *canvas, *alignment;
|
||||||
|
gchar *full_path;
|
||||||
|
|
||||||
|
if (!string1)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
full_path = g_strdup_printf ("%s/%s", GNOMECC_PIXMAPS_DIR, string1);
|
||||||
|
canvas = mouse_capplet_create_image_widget_canvas (full_path);
|
||||||
|
g_free (full_path);
|
||||||
|
|
||||||
|
g_return_val_if_fail (canvas != NULL, NULL);
|
||||||
|
|
||||||
|
alignment = gtk_widget_new (gtk_alignment_get_type(),
|
||||||
|
"child", canvas,
|
||||||
|
"xalign", (double) 0,
|
||||||
|
"yalign", (double) 0,
|
||||||
|
"xscale", (double) 0,
|
||||||
|
"yscale", (double) 0,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
gtk_widget_show (alignment);
|
||||||
|
|
||||||
|
return alignment;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xst_fool_the_linker:
|
||||||
|
* @void:
|
||||||
|
*
|
||||||
|
* We need to keep the symbol for the create image widget function
|
||||||
|
* so that libglade can find it to create the icons.
|
||||||
|
**/
|
||||||
|
void capplet_fool_the_linker (void);
|
||||||
|
void
|
||||||
|
capplet_fool_the_linker (void)
|
||||||
|
{
|
||||||
|
mouse_capplet_create_image_widget (NULL, NULL, NULL, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/* create_dialog
|
/* create_dialog
|
||||||
*
|
*
|
||||||
* Create the dialog box and return it as a GtkWidget
|
* Create the dialog box and return it as a GtkWidget
|
||||||
|
@ -132,9 +212,6 @@ create_dialog (void)
|
||||||
widget = glade_xml_get_widget (dialog, "prefs_widget");
|
widget = glade_xml_get_widget (dialog, "prefs_widget");
|
||||||
gtk_object_set_data (GTK_OBJECT (widget), "glade-data", dialog);
|
gtk_object_set_data (GTK_OBJECT (widget), "glade-data", dialog);
|
||||||
|
|
||||||
set_pixmap_file (WID ("mouse_left_pixmap"), GNOMECC_PIXMAPS_DIR "/mouse-left.png");
|
|
||||||
set_pixmap_file (WID ("mouse_right_pixmap"), GNOMECC_PIXMAPS_DIR "/mouse-right.png");
|
|
||||||
|
|
||||||
gtk_signal_connect_object (GTK_OBJECT (widget), "destroy",
|
gtk_signal_connect_object (GTK_OBJECT (widget), "destroy",
|
||||||
GTK_SIGNAL_FUNC (gtk_object_destroy),
|
GTK_SIGNAL_FUNC (gtk_object_destroy),
|
||||||
GTK_OBJECT (dialog));
|
GTK_OBJECT (dialog));
|
||||||
|
|
|
@ -95,7 +95,6 @@ apply_settings (Bonobo_ConfigDatabase db)
|
||||||
*
|
*
|
||||||
* Load the given pixmap and put it in the given widget. FIXME: Should this be in libcommon?
|
* Load the given pixmap and put it in the given widget. FIXME: Should this be in libcommon?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_pixmap_file (GtkWidget *widget, const gchar *filename)
|
set_pixmap_file (GtkWidget *widget, const gchar *filename)
|
||||||
{
|
{
|
||||||
|
@ -117,6 +116,87 @@ set_pixmap_file (GtkWidget *widget, const gchar *filename)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static GtkWidget *
|
||||||
|
mouse_capplet_create_image_widget_canvas (gchar *filename)
|
||||||
|
{
|
||||||
|
GtkWidget *canvas;
|
||||||
|
GdkPixbuf *pixbuf;
|
||||||
|
double width, height;
|
||||||
|
gchar *filename_dup;
|
||||||
|
|
||||||
|
filename_dup = g_strdup (filename);
|
||||||
|
pixbuf = gdk_pixbuf_new_from_file (filename_dup);
|
||||||
|
|
||||||
|
if (!pixbuf) {
|
||||||
|
g_warning ("Pixmap %s not found.", filename_dup);
|
||||||
|
g_free (filename_dup);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
width = gdk_pixbuf_get_width (pixbuf);
|
||||||
|
height = gdk_pixbuf_get_height (pixbuf);
|
||||||
|
|
||||||
|
canvas = gnome_canvas_new_aa();
|
||||||
|
GTK_OBJECT_UNSET_FLAGS (GTK_WIDGET (canvas), GTK_CAN_FOCUS);
|
||||||
|
gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS(canvas)),
|
||||||
|
gnome_canvas_pixbuf_get_type (),
|
||||||
|
"pixbuf", pixbuf,
|
||||||
|
NULL);
|
||||||
|
gtk_widget_set_usize (canvas, width, height);
|
||||||
|
|
||||||
|
gdk_pixbuf_unref (pixbuf);
|
||||||
|
gtk_widget_show (canvas);
|
||||||
|
g_free (filename_dup);
|
||||||
|
|
||||||
|
return canvas;
|
||||||
|
}
|
||||||
|
|
||||||
|
GtkWidget *
|
||||||
|
mouse_capplet_create_image_widget (gchar *name,
|
||||||
|
gchar *string1, gchar *string2,
|
||||||
|
gint int1, gint int2)
|
||||||
|
{
|
||||||
|
GtkWidget *canvas, *alignment;
|
||||||
|
gchar *full_path;
|
||||||
|
|
||||||
|
if (!string1)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
full_path = g_strdup_printf ("%s/%s", GNOMECC_PIXMAPS_DIR, string1);
|
||||||
|
canvas = mouse_capplet_create_image_widget_canvas (full_path);
|
||||||
|
g_free (full_path);
|
||||||
|
|
||||||
|
g_return_val_if_fail (canvas != NULL, NULL);
|
||||||
|
|
||||||
|
alignment = gtk_widget_new (gtk_alignment_get_type(),
|
||||||
|
"child", canvas,
|
||||||
|
"xalign", (double) 0,
|
||||||
|
"yalign", (double) 0,
|
||||||
|
"xscale", (double) 0,
|
||||||
|
"yscale", (double) 0,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
gtk_widget_show (alignment);
|
||||||
|
|
||||||
|
return alignment;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xst_fool_the_linker:
|
||||||
|
* @void:
|
||||||
|
*
|
||||||
|
* We need to keep the symbol for the create image widget function
|
||||||
|
* so that libglade can find it to create the icons.
|
||||||
|
**/
|
||||||
|
void capplet_fool_the_linker (void);
|
||||||
|
void
|
||||||
|
capplet_fool_the_linker (void)
|
||||||
|
{
|
||||||
|
mouse_capplet_create_image_widget (NULL, NULL, NULL, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/* create_dialog
|
/* create_dialog
|
||||||
*
|
*
|
||||||
* Create the dialog box and return it as a GtkWidget
|
* Create the dialog box and return it as a GtkWidget
|
||||||
|
@ -132,9 +212,6 @@ create_dialog (void)
|
||||||
widget = glade_xml_get_widget (dialog, "prefs_widget");
|
widget = glade_xml_get_widget (dialog, "prefs_widget");
|
||||||
gtk_object_set_data (GTK_OBJECT (widget), "glade-data", dialog);
|
gtk_object_set_data (GTK_OBJECT (widget), "glade-data", dialog);
|
||||||
|
|
||||||
set_pixmap_file (WID ("mouse_left_pixmap"), GNOMECC_PIXMAPS_DIR "/mouse-left.png");
|
|
||||||
set_pixmap_file (WID ("mouse_right_pixmap"), GNOMECC_PIXMAPS_DIR "/mouse-right.png");
|
|
||||||
|
|
||||||
gtk_signal_connect_object (GTK_OBJECT (widget), "destroy",
|
gtk_signal_connect_object (GTK_OBJECT (widget), "destroy",
|
||||||
GTK_SIGNAL_FUNC (gtk_object_destroy),
|
GTK_SIGNAL_FUNC (gtk_object_destroy),
|
||||||
GTK_OBJECT (dialog));
|
GTK_OBJECT (dialog));
|
||||||
|
|
|
@ -108,7 +108,7 @@
|
||||||
<columns>2</columns>
|
<columns>2</columns>
|
||||||
<homogeneous>False</homogeneous>
|
<homogeneous>False</homogeneous>
|
||||||
<row_spacing>0</row_spacing>
|
<row_spacing>0</row_spacing>
|
||||||
<column_spacing>0</column_spacing>
|
<column_spacing>12</column_spacing>
|
||||||
<child>
|
<child>
|
||||||
<padding>0</padding>
|
<padding>0</padding>
|
||||||
<expand>False</expand>
|
<expand>False</expand>
|
||||||
|
@ -174,13 +174,13 @@
|
||||||
</widget>
|
</widget>
|
||||||
|
|
||||||
<widget>
|
<widget>
|
||||||
<class>GtkPixmap</class>
|
<class>Custom</class>
|
||||||
<name>mouse_left_pixmap</name>
|
<name>pixmap_left</name>
|
||||||
<xalign>0.5</xalign>
|
<creation_function>mouse_capplet_create_image_widget</creation_function>
|
||||||
<yalign>0.5</yalign>
|
<string1>mouse-left.png</string1>
|
||||||
<xpad>0</xpad>
|
<int1>0</int1>
|
||||||
<ypad>0</ypad>
|
<int2>0</int2>
|
||||||
<build_insensitive>True</build_insensitive>
|
<last_modification_time>Fri, 07 Sep 2001 21:24:35 GMT</last_modification_time>
|
||||||
<child>
|
<child>
|
||||||
<left_attach>0</left_attach>
|
<left_attach>0</left_attach>
|
||||||
<right_attach>1</right_attach>
|
<right_attach>1</right_attach>
|
||||||
|
@ -188,7 +188,7 @@
|
||||||
<bottom_attach>1</bottom_attach>
|
<bottom_attach>1</bottom_attach>
|
||||||
<xpad>0</xpad>
|
<xpad>0</xpad>
|
||||||
<ypad>0</ypad>
|
<ypad>0</ypad>
|
||||||
<xexpand>True</xexpand>
|
<xexpand>False</xexpand>
|
||||||
<yexpand>False</yexpand>
|
<yexpand>False</yexpand>
|
||||||
<xshrink>False</xshrink>
|
<xshrink>False</xshrink>
|
||||||
<yshrink>False</yshrink>
|
<yshrink>False</yshrink>
|
||||||
|
@ -198,13 +198,13 @@
|
||||||
</widget>
|
</widget>
|
||||||
|
|
||||||
<widget>
|
<widget>
|
||||||
<class>GtkPixmap</class>
|
<class>Custom</class>
|
||||||
<name>mouse_right_pixmap</name>
|
<name>custom2</name>
|
||||||
<xalign>0.5</xalign>
|
<creation_function>mouse_capplet_create_image_widget</creation_function>
|
||||||
<yalign>0.5</yalign>
|
<string1>mouse-right.png</string1>
|
||||||
<xpad>0</xpad>
|
<int1>0</int1>
|
||||||
<ypad>0</ypad>
|
<int2>0</int2>
|
||||||
<build_insensitive>True</build_insensitive>
|
<last_modification_time>Fri, 07 Sep 2001 21:39:40 GMT</last_modification_time>
|
||||||
<child>
|
<child>
|
||||||
<left_attach>1</left_attach>
|
<left_attach>1</left_attach>
|
||||||
<right_attach>2</right_attach>
|
<right_attach>2</right_attach>
|
||||||
|
@ -212,7 +212,7 @@
|
||||||
<bottom_attach>1</bottom_attach>
|
<bottom_attach>1</bottom_attach>
|
||||||
<xpad>0</xpad>
|
<xpad>0</xpad>
|
||||||
<ypad>0</ypad>
|
<ypad>0</ypad>
|
||||||
<xexpand>True</xexpand>
|
<xexpand>False</xexpand>
|
||||||
<yexpand>False</yexpand>
|
<yexpand>False</yexpand>
|
||||||
<xshrink>False</xshrink>
|
<xshrink>False</xshrink>
|
||||||
<yshrink>False</yshrink>
|
<yshrink>False</yshrink>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue