Fix indentation
This commit is contained in:
parent
4d716abc23
commit
55d6d23392
8 changed files with 251 additions and 246 deletions
|
@ -9,14 +9,14 @@ SUBDIRS = \
|
|||
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
|
||||
|
||||
install-data-hook:
|
||||
@-if test -z "$(DESTDIR)"; then \
|
||||
echo "Updating Gtk icon cache."; \
|
||||
$(gtk_update_icon_cache); \
|
||||
else \
|
||||
@-if test -z "$(DESTDIR)"; then \
|
||||
echo "Updating Gtk icon cache."; \
|
||||
$(gtk_update_icon_cache); \
|
||||
else \
|
||||
echo "*** Icon cache not updated. Remember to run:"; \
|
||||
echo "***"; \
|
||||
echo "*** $(gtk_update_icon_cache)"; \
|
||||
echo "***"; \
|
||||
echo "***"; \
|
||||
echo "*** $(gtk_update_icon_cache)"; \
|
||||
echo "***"; \
|
||||
fi
|
||||
|
||||
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
|
||||
|
|
|
@ -63,72 +63,76 @@ static gboolean eyes_set_size (XfcePanelPlugin *plugin,
|
|||
*****************************/
|
||||
static void
|
||||
calculate_pupil_xy (EyesPlugin *eyes_applet,
|
||||
gint x,
|
||||
gint y,
|
||||
gint *pupil_x,
|
||||
gint *pupil_y,
|
||||
GtkWidget *widget)
|
||||
gint x,
|
||||
gint y,
|
||||
gint *pupil_x,
|
||||
gint *pupil_y,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
double nx, ny;
|
||||
double distance;
|
||||
double angle, angle_z;
|
||||
double radius_x, radius_y;
|
||||
double nx, ny;
|
||||
double distance;
|
||||
double angle, angle_z;
|
||||
double radius_x, radius_y;
|
||||
|
||||
GtkAllocation allocation;
|
||||
GtkAlign halign, valign;
|
||||
gfloat xalign = 0, yalign = 0;
|
||||
gint width, height;
|
||||
GtkAllocation allocation;
|
||||
GtkAlign halign, valign;
|
||||
gfloat xalign = 0, yalign = 0;
|
||||
gint width, height;
|
||||
|
||||
gtk_widget_get_allocation (GTK_WIDGET(widget), &allocation);
|
||||
gtk_widget_get_allocation (GTK_WIDGET (widget), &allocation);
|
||||
|
||||
width = allocation.width;
|
||||
height = allocation.height;
|
||||
halign = gtk_widget_get_halign (GTK_WIDGET(widget));
|
||||
valign = gtk_widget_get_valign (GTK_WIDGET(widget));
|
||||
width = allocation.width;
|
||||
height = allocation.height;
|
||||
halign = gtk_widget_get_halign (GTK_WIDGET (widget));
|
||||
valign = gtk_widget_get_valign (GTK_WIDGET (widget));
|
||||
|
||||
if (halign == GTK_ALIGN_CENTER) xalign = 0.5;
|
||||
else if (halign == GTK_ALIGN_END) xalign = 1;
|
||||
if (halign == GTK_ALIGN_CENTER)
|
||||
xalign = 0.5;
|
||||
else if (halign == GTK_ALIGN_END)
|
||||
xalign = 1;
|
||||
|
||||
if (valign == GTK_ALIGN_CENTER) yalign = 0.5;
|
||||
else if (valign == GTK_ALIGN_END) yalign = 1;
|
||||
if (valign == GTK_ALIGN_CENTER)
|
||||
yalign = 0.5;
|
||||
else if (valign == GTK_ALIGN_END)
|
||||
yalign = 1;
|
||||
|
||||
/* calculate x,y pointer offsets wrt to eye center */
|
||||
nx = x - MAX(width - eyes_applet->eye_width, 0) * xalign
|
||||
- eyes_applet->eye_width / 2 - allocation.x;
|
||||
ny = y - MAX(height - eyes_applet->eye_height, 0) * yalign
|
||||
- eyes_applet->eye_height / 2 - allocation.y;
|
||||
nx = x - MAX (width - eyes_applet->eye_width, 0) * xalign
|
||||
- eyes_applet->eye_width / 2 - allocation.x;
|
||||
ny = y - MAX (height - eyes_applet->eye_height, 0) * yalign
|
||||
- eyes_applet->eye_height / 2 - allocation.y;
|
||||
|
||||
/* calculate eye sizes */
|
||||
radius_x = (eyes_applet->eye_width -
|
||||
eyes_applet->wall_thickness -
|
||||
eyes_applet->pupil_width) / 2.0;
|
||||
radius_y = (eyes_applet->eye_height -
|
||||
eyes_applet->wall_thickness -
|
||||
eyes_applet->pupil_height) / 2.0;
|
||||
/* calculate eye sizes */
|
||||
radius_x = (eyes_applet->eye_width -
|
||||
eyes_applet->wall_thickness -
|
||||
eyes_applet->pupil_width) / 2.0;
|
||||
radius_y = (eyes_applet->eye_height -
|
||||
eyes_applet->wall_thickness -
|
||||
eyes_applet->pupil_height) / 2.0;
|
||||
|
||||
/* by default assume the z-axis distance of 3 radius_x */
|
||||
distance = 3 * radius_x;
|
||||
/* by default assume the z-axis distance of 3 radius_x */
|
||||
distance = 3 * radius_x;
|
||||
|
||||
/* correction factor for aspect ratio of the eye */
|
||||
if (radius_y != 0)
|
||||
ny *= radius_x / radius_y;
|
||||
/* correction factor for aspect ratio of the eye */
|
||||
if (radius_y != 0)
|
||||
ny *= radius_x / radius_y;
|
||||
|
||||
/* calculate 3D rotation angles */
|
||||
angle_z = atan2 (ny, nx);
|
||||
angle = atan2 (hypot (nx, ny), distance);
|
||||
/* calculate 3D rotation angles */
|
||||
angle_z = atan2 (ny, nx);
|
||||
angle = atan2 (hypot (nx, ny), distance);
|
||||
|
||||
/* perform 3D rotation of a vector [0,0,1] (z=1) */
|
||||
*pupil_x = radius_x * sin (angle) * cos (angle_z) + eyes_applet->eye_width / 2;
|
||||
*pupil_y = radius_y * sin (angle) * sin (angle_z) + eyes_applet->eye_height / 2;
|
||||
/* perform 3D rotation of a vector [0,0,1] (z=1) */
|
||||
*pupil_x = radius_x * sin (angle) * cos (angle_z) + eyes_applet->eye_width / 2;
|
||||
*pupil_y = radius_y * sin (angle) * sin (angle_z) + eyes_applet->eye_height / 2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
draw_eye (EyesPlugin *eyes,
|
||||
gint eye_num,
|
||||
gint pupil_x,
|
||||
gint pupil_y)
|
||||
gint eye_num,
|
||||
gint pupil_x,
|
||||
gint pupil_y)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkRectangle rect, r1, r2;
|
||||
|
@ -144,23 +148,21 @@ draw_eye (EyesPlugin *eyes,
|
|||
r2.height = eyes->eye_height;
|
||||
gdk_rectangle_intersect (&r1, &r2, &rect);
|
||||
gdk_pixbuf_composite (eyes->pupil_image, pixbuf,
|
||||
rect.x,
|
||||
rect.y,
|
||||
rect.width,
|
||||
rect.height,
|
||||
pupil_x - eyes->pupil_width / 2,
|
||||
pupil_y - eyes->pupil_height / 2, 1.0, 1.0,
|
||||
GDK_INTERP_BILINEAR,
|
||||
255);
|
||||
gtk_image_set_from_pixbuf (GTK_IMAGE (eyes->eyes[eye_num]),
|
||||
pixbuf);
|
||||
rect.x,
|
||||
rect.y,
|
||||
rect.width,
|
||||
rect.height,
|
||||
pupil_x - eyes->pupil_width / 2,
|
||||
pupil_y - eyes->pupil_height / 2,
|
||||
1.0, 1.0, GDK_INTERP_BILINEAR, 255);
|
||||
gtk_image_set_from_pixbuf (GTK_IMAGE (eyes->eyes[eye_num]), pixbuf);
|
||||
g_object_unref (G_OBJECT (pixbuf));
|
||||
}
|
||||
|
||||
|
||||
|
||||
static gint
|
||||
timer_cb(EyesPlugin *eyes)
|
||||
timer_cb (EyesPlugin *eyes)
|
||||
{
|
||||
gint x, y;
|
||||
gint pupil_x, pupil_y;
|
||||
|
@ -168,11 +170,11 @@ timer_cb(EyesPlugin *eyes)
|
|||
GdkWindow *window;
|
||||
GdkDevice *mouse_device;
|
||||
|
||||
#if GTK_CHECK_VERSION(3,2,0)
|
||||
GdkSeat *seat = gdk_display_get_default_seat (gdk_display_get_default());
|
||||
#if GTK_CHECK_VERSION (3,2,0)
|
||||
GdkSeat *seat = gdk_display_get_default_seat (gdk_display_get_default ());
|
||||
mouse_device = gdk_seat_get_pointer (seat);
|
||||
#else
|
||||
GdkDeviceManager *devman = gdk_display_get_device_manager (gdk_display_get_default());
|
||||
GdkDeviceManager *devman = gdk_display_get_device_manager (gdk_display_get_default ());
|
||||
mouse_device = gdk_device_manager_get_client_pointer (devman);
|
||||
#endif
|
||||
|
||||
|
@ -206,91 +208,91 @@ timer_cb(EyesPlugin *eyes)
|
|||
|
||||
|
||||
static void
|
||||
properties_load(EyesPlugin *eyes)
|
||||
properties_load (EyesPlugin *eyes)
|
||||
{
|
||||
gchar *path;
|
||||
|
||||
if (eyes->active_theme)
|
||||
path = g_build_filename(THEMESDIR, eyes->active_theme, NULL);
|
||||
path = g_build_filename (THEMESDIR, eyes->active_theme, NULL);
|
||||
else
|
||||
path = g_build_filename(THEMESDIR, DEFAULTTHEME, NULL);
|
||||
path = g_build_filename (THEMESDIR, DEFAULTTHEME, NULL);
|
||||
|
||||
load_theme(eyes, path);
|
||||
load_theme (eyes, path);
|
||||
|
||||
g_free(path);
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
setup_eyes(EyesPlugin *eyes)
|
||||
setup_eyes (EyesPlugin *eyes)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (eyes->hbox != NULL)
|
||||
{
|
||||
gtk_widget_destroy(eyes->hbox);
|
||||
gtk_widget_destroy (eyes->hbox);
|
||||
eyes->hbox = NULL;
|
||||
}
|
||||
|
||||
eyes->hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_container_add(GTK_CONTAINER(eyes->align), GTK_WIDGET(eyes->hbox));
|
||||
eyes->hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_container_add (GTK_CONTAINER (eyes->align), GTK_WIDGET (eyes->hbox));
|
||||
|
||||
eyes->eyes = g_new0 (GtkWidget *, eyes->num_eyes);
|
||||
eyes->pointer_last_x = g_new0 (gint, eyes->num_eyes);
|
||||
eyes->pointer_last_y = g_new0 (gint, eyes->num_eyes);
|
||||
eyes->pointer_last_x = g_new0 (gint, eyes->num_eyes);
|
||||
eyes->pointer_last_y = g_new0 (gint, eyes->num_eyes);
|
||||
|
||||
for (i = 0; i < eyes->num_eyes; i++)
|
||||
{
|
||||
eyes->eyes[i] = gtk_image_new ();
|
||||
|
||||
gtk_widget_set_size_request(GTK_WIDGET(eyes->eyes[i]),
|
||||
eyes->eye_width,
|
||||
eyes->eye_height);
|
||||
gtk_widget_set_size_request (GTK_WIDGET (eyes->eyes[i]),
|
||||
eyes->eye_width,
|
||||
eyes->eye_height);
|
||||
|
||||
gtk_widget_show(eyes->eyes[i]);
|
||||
gtk_widget_show (eyes->eyes[i]);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(eyes->hbox), eyes->eyes[i],
|
||||
FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (eyes->hbox), eyes->eyes[i],
|
||||
FALSE, FALSE, 0);
|
||||
|
||||
if ((eyes->num_eyes != 1) && (i == 0))
|
||||
{
|
||||
gtk_widget_set_halign (GTK_WIDGET (eyes->eyes[i]), GTK_ALIGN_END);
|
||||
gtk_widget_set_valign (GTK_WIDGET (eyes->eyes[i]), GTK_ALIGN_CENTER);
|
||||
}
|
||||
else if ((eyes->num_eyes != 1) && (i == eyes->num_eyes - 1))
|
||||
{
|
||||
gtk_widget_set_halign (GTK_WIDGET (eyes->eyes[i]), GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (GTK_WIDGET (eyes->eyes[i]), GTK_ALIGN_CENTER);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_set_halign (GTK_WIDGET (eyes->eyes[i]), GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (GTK_WIDGET (eyes->eyes[i]), GTK_ALIGN_CENTER);
|
||||
}
|
||||
if ((eyes->num_eyes != 1) && (i == 0))
|
||||
{
|
||||
gtk_widget_set_halign (GTK_WIDGET (eyes->eyes[i]), GTK_ALIGN_END);
|
||||
gtk_widget_set_valign (GTK_WIDGET (eyes->eyes[i]), GTK_ALIGN_CENTER);
|
||||
}
|
||||
else if ((eyes->num_eyes != 1) && (i == eyes->num_eyes - 1))
|
||||
{
|
||||
gtk_widget_set_halign (GTK_WIDGET (eyes->eyes[i]), GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (GTK_WIDGET (eyes->eyes[i]), GTK_ALIGN_CENTER);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_set_halign (GTK_WIDGET (eyes->eyes[i]), GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (GTK_WIDGET (eyes->eyes[i]), GTK_ALIGN_CENTER);
|
||||
}
|
||||
|
||||
eyes->pointer_last_x[i] = G_MAXINT;
|
||||
eyes->pointer_last_y[i] = G_MAXINT;
|
||||
eyes->pointer_last_x[i] = G_MAXINT;
|
||||
eyes->pointer_last_y[i] = G_MAXINT;
|
||||
|
||||
draw_eye (eyes, i,
|
||||
eyes->eye_width / 2,
|
||||
draw_eye (eyes, i,
|
||||
eyes->eye_width / 2,
|
||||
eyes->eye_height / 2);
|
||||
}
|
||||
|
||||
gtk_widget_show(eyes->hbox);
|
||||
gtk_widget_show (eyes->hbox);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static gboolean
|
||||
eyes_applet_fill(EyesPlugin *eyes)
|
||||
eyes_applet_fill (EyesPlugin *eyes)
|
||||
{
|
||||
gtk_widget_show_all(GTK_WIDGET(eyes->align));
|
||||
gtk_widget_show_all (GTK_WIDGET (eyes->align));
|
||||
|
||||
if (eyes->timeout_id == 0)
|
||||
{
|
||||
eyes->timeout_id = g_timeout_add (UPDATE_TIMEOUT,
|
||||
(GSourceFunc)timer_cb, eyes);
|
||||
(GSourceFunc) timer_cb, eyes);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -319,20 +321,21 @@ static void
|
|||
combobox_changed (GtkComboBox *combobox,
|
||||
EyesPlugin *eyes)
|
||||
{
|
||||
gchar *selected = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (combobox));
|
||||
gchar *selected = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (combobox));
|
||||
|
||||
if (eyes->active_theme)
|
||||
g_free (eyes->active_theme);
|
||||
if (eyes->active_theme)
|
||||
g_free (eyes->active_theme);
|
||||
|
||||
eyes->active_theme = g_strdup (selected);
|
||||
g_free (selected);
|
||||
eyes->active_theme = g_strdup (selected);
|
||||
g_free (selected);
|
||||
|
||||
properties_load(eyes);
|
||||
setup_eyes(eyes);
|
||||
eyes_applet_fill(eyes);
|
||||
properties_load (eyes);
|
||||
setup_eyes (eyes);
|
||||
eyes_applet_fill (eyes);
|
||||
|
||||
eyes_set_size(eyes->plugin, xfce_panel_plugin_get_size(eyes->plugin),
|
||||
eyes);
|
||||
eyes_set_size (eyes->plugin,
|
||||
xfce_panel_plugin_get_size (eyes->plugin),
|
||||
eyes);
|
||||
}
|
||||
|
||||
|
||||
|
@ -341,9 +344,10 @@ static void
|
|||
check_single_row_toggled (GtkWidget *check,
|
||||
EyesPlugin *eyes)
|
||||
{
|
||||
eyes->single_row = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check));
|
||||
eyes_set_size(eyes->plugin, xfce_panel_plugin_get_size(eyes->plugin),
|
||||
eyes);
|
||||
eyes->single_row = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check));
|
||||
eyes_set_size (eyes->plugin,
|
||||
xfce_panel_plugin_get_size (eyes->plugin),
|
||||
eyes);
|
||||
}
|
||||
|
||||
|
||||
|
@ -352,71 +356,71 @@ static void
|
|||
eyes_properties_dialog (XfcePanelPlugin *plugin,
|
||||
EyesPlugin *eyes)
|
||||
{
|
||||
GtkWidget *dlg, *hbox, *label, *combobox, *check, *area;
|
||||
GDir *dir;
|
||||
gint i;
|
||||
gchar *current;
|
||||
const gchar *entry;
|
||||
GtkWidget *dlg, *hbox, *label, *combobox, *check, *area;
|
||||
GDir *dir;
|
||||
gint i;
|
||||
gchar *current;
|
||||
const gchar *entry;
|
||||
|
||||
xfce_panel_plugin_block_menu (plugin);
|
||||
xfce_panel_plugin_block_menu (plugin);
|
||||
|
||||
dlg = xfce_titled_dialog_new_with_buttons (_("Eyes"),
|
||||
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (plugin))),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
"gtk-close", GTK_RESPONSE_OK,
|
||||
NULL);
|
||||
dlg = xfce_titled_dialog_new_with_buttons (_("Eyes"),
|
||||
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (plugin))),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
"gtk-close", GTK_RESPONSE_OK,
|
||||
NULL);
|
||||
|
||||
gtk_window_set_position (GTK_WINDOW (dlg), GTK_WIN_POS_CENTER);
|
||||
gtk_window_set_icon_name (GTK_WINDOW (dlg), "xfce4-settings");
|
||||
gtk_window_set_position (GTK_WINDOW (dlg), GTK_WIN_POS_CENTER);
|
||||
gtk_window_set_icon_name (GTK_WINDOW (dlg), "xfce4-settings");
|
||||
|
||||
g_signal_connect (dlg, "response", G_CALLBACK (eyes_properties_dialog_response),
|
||||
g_signal_connect (dlg, "response",
|
||||
G_CALLBACK (eyes_properties_dialog_response),
|
||||
eyes);
|
||||
|
||||
area = gtk_dialog_get_content_area (GTK_DIALOG (dlg));
|
||||
hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
|
||||
gtk_box_pack_start (GTK_BOX (area), hbox, FALSE, FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
|
||||
area = gtk_dialog_get_content_area (GTK_DIALOG (dlg));
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
||||
gtk_box_pack_start (GTK_BOX (area), hbox, FALSE, FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
|
||||
|
||||
label = gtk_label_new_with_mnemonic (_("_Select a theme:"));
|
||||
gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0);
|
||||
label = gtk_label_new_with_mnemonic (_("_Select a theme:"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
|
||||
combobox = gtk_combo_box_text_new ();
|
||||
combobox = gtk_combo_box_text_new ();
|
||||
gtk_box_pack_start (GTK_BOX (hbox), combobox, FALSE, TRUE, 0);
|
||||
|
||||
if (eyes->active_theme)
|
||||
current = g_strdup (eyes->active_theme);
|
||||
else
|
||||
current = g_strdup (DEFAULTTHEME);
|
||||
current = g_strdup (eyes->active_theme);
|
||||
else
|
||||
current = g_strdup (DEFAULTTHEME);
|
||||
|
||||
if ((dir = g_dir_open(THEMESDIR, 0, NULL)) == NULL)
|
||||
if ((dir = g_dir_open (THEMESDIR, 0, NULL)) == NULL)
|
||||
{
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), current);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; (entry = g_dir_read_name(dir)) != NULL; i++)
|
||||
for (i = 0; (entry = g_dir_read_name (dir)) != NULL; i++)
|
||||
{
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), entry);
|
||||
|
||||
if (strcmp (entry, current) == 0)
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX(combobox), i);
|
||||
}
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), i);
|
||||
}
|
||||
|
||||
g_dir_close(dir);
|
||||
}
|
||||
g_dir_close (dir);
|
||||
}
|
||||
|
||||
g_free (current);
|
||||
g_free (current);
|
||||
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combobox);
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combobox);
|
||||
|
||||
g_signal_connect(G_OBJECT(combobox), "changed",
|
||||
G_CALLBACK(combobox_changed), eyes);
|
||||
g_signal_connect (G_OBJECT (combobox), "changed",
|
||||
G_CALLBACK (combobox_changed), eyes);
|
||||
|
||||
check = gtk_check_button_new_with_mnemonic
|
||||
(_("Use single _row in multi-row panel"));
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), eyes->single_row);
|
||||
gtk_box_pack_start (GTK_BOX (area), check, FALSE, FALSE, 0);
|
||||
g_signal_connect(check, "toggled", G_CALLBACK(check_single_row_toggled), eyes);
|
||||
check = gtk_check_button_new_with_mnemonic (_("Use single _row in multi-row panel"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), eyes->single_row);
|
||||
gtk_box_pack_start (GTK_BOX (area), check, FALSE, FALSE, 0);
|
||||
g_signal_connect (check, "toggled", G_CALLBACK (check_single_row_toggled), eyes);
|
||||
|
||||
gtk_widget_show_all (dlg);
|
||||
}
|
||||
|
@ -427,21 +431,21 @@ eyes_properties_dialog (XfcePanelPlugin *plugin,
|
|||
*** Panel Plugin Functions ***
|
||||
******************************/
|
||||
static void
|
||||
eyes_free_data(XfcePanelPlugin *plugin,
|
||||
EyesPlugin *eyes)
|
||||
eyes_free_data (XfcePanelPlugin *plugin,
|
||||
EyesPlugin *eyes)
|
||||
{
|
||||
g_return_if_fail(plugin != NULL);
|
||||
g_return_if_fail(eyes != NULL);
|
||||
g_return_if_fail (plugin != NULL);
|
||||
g_return_if_fail (eyes != NULL);
|
||||
|
||||
if (eyes->timeout_id != 0)
|
||||
g_source_remove (eyes->timeout_id);
|
||||
|
||||
g_free (eyes->eyes);
|
||||
g_free (eyes->pointer_last_x);
|
||||
g_free (eyes->pointer_last_y);
|
||||
g_free (eyes->pointer_last_x);
|
||||
g_free (eyes->pointer_last_y);
|
||||
|
||||
if (eyes->active_theme != NULL)
|
||||
g_free (eyes->active_theme);
|
||||
if (eyes->active_theme != NULL)
|
||||
g_free (eyes->active_theme);
|
||||
|
||||
if (eyes->eye_image != NULL)
|
||||
g_object_unref (G_OBJECT (eyes->eye_image));
|
||||
|
@ -450,19 +454,19 @@ eyes_free_data(XfcePanelPlugin *plugin,
|
|||
g_object_unref (G_OBJECT (eyes->pupil_image));
|
||||
|
||||
if (eyes->theme_dir != NULL)
|
||||
g_free(eyes->theme_dir);
|
||||
g_free (eyes->theme_dir);
|
||||
|
||||
if (eyes->theme_name != NULL)
|
||||
g_free(eyes->theme_name);
|
||||
g_free (eyes->theme_name);
|
||||
|
||||
if (eyes->eye_filename != NULL)
|
||||
g_free(eyes->eye_filename);
|
||||
g_free (eyes->eye_filename);
|
||||
|
||||
if (eyes->pupil_filename != NULL)
|
||||
g_free(eyes->pupil_filename);
|
||||
g_free (eyes->pupil_filename);
|
||||
|
||||
gtk_widget_destroy(eyes->align);
|
||||
g_free(eyes);
|
||||
gtk_widget_destroy (eyes->align);
|
||||
g_free (eyes);
|
||||
}
|
||||
|
||||
|
||||
|
@ -487,17 +491,17 @@ eyes_mode_changed (XfcePanelPlugin *plugin,
|
|||
if (mode == XFCE_PANEL_PLUGIN_MODE_VERTICAL ||
|
||||
mode == XFCE_PANEL_PLUGIN_MODE_DESKBAR)
|
||||
{
|
||||
gtk_widget_set_halign(GTK_WIDGET(eyes->align), GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign(GTK_WIDGET(eyes->align), GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_hexpand(GTK_WIDGET(eyes->align), FALSE);
|
||||
gtk_widget_set_vexpand(GTK_WIDGET(eyes->align), TRUE);
|
||||
gtk_widget_set_halign (GTK_WIDGET (eyes->align), GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (GTK_WIDGET (eyes->align), GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_hexpand (GTK_WIDGET (eyes->align), FALSE);
|
||||
gtk_widget_set_vexpand (GTK_WIDGET (eyes->align), TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_set_halign(GTK_WIDGET(eyes->align), GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign(GTK_WIDGET(eyes->align), GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_hexpand(GTK_WIDGET(eyes->align), TRUE);
|
||||
gtk_widget_set_vexpand(GTK_WIDGET(eyes->align), FALSE);
|
||||
gtk_widget_set_halign (GTK_WIDGET (eyes->align), GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (GTK_WIDGET (eyes->align), GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_hexpand (GTK_WIDGET (eyes->align), TRUE);
|
||||
gtk_widget_set_vexpand (GTK_WIDGET (eyes->align), FALSE);
|
||||
}
|
||||
|
||||
eyes_set_size (plugin, xfce_panel_plugin_get_size (plugin), eyes);
|
||||
|
@ -541,7 +545,7 @@ eyes_read_rc_file (XfcePanelPlugin *plugin,
|
|||
}
|
||||
|
||||
if (eyes->active_theme == NULL)
|
||||
eyes->active_theme = g_strdup (DEFAULTTHEME);
|
||||
eyes->active_theme = g_strdup (DEFAULTTHEME);
|
||||
}
|
||||
|
||||
|
||||
|
@ -575,28 +579,28 @@ eyes_write_rc_file (XfcePanelPlugin *plugin,
|
|||
static EyesPlugin *
|
||||
eyes_plugin_new (XfcePanelPlugin* plugin)
|
||||
{
|
||||
EyesPlugin *eyes = g_new0(EyesPlugin, 1);
|
||||
EyesPlugin *eyes = g_new0 (EyesPlugin, 1);
|
||||
|
||||
eyes->plugin = plugin;
|
||||
|
||||
eyes->ebox = gtk_event_box_new ();
|
||||
gtk_event_box_set_visible_window (GTK_EVENT_BOX (eyes->ebox), FALSE);
|
||||
gtk_widget_show(eyes->ebox);
|
||||
gtk_widget_show (eyes->ebox);
|
||||
|
||||
eyes->align = gtk_box_new (GTK_ORIENTATION_VERTICAL, 1);
|
||||
gtk_widget_set_halign(GTK_WIDGET(eyes->align), GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign(GTK_WIDGET(eyes->align), GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_hexpand(GTK_WIDGET(eyes->align), TRUE);
|
||||
gtk_widget_set_vexpand(GTK_WIDGET(eyes->align), TRUE);
|
||||
gtk_widget_set_halign (GTK_WIDGET (eyes->align), GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (GTK_WIDGET (eyes->align), GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_hexpand (GTK_WIDGET (eyes->align), TRUE);
|
||||
gtk_widget_set_vexpand (GTK_WIDGET (eyes->align), TRUE);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(eyes->ebox), eyes->align);
|
||||
gtk_widget_show(eyes->align);
|
||||
gtk_container_add (GTK_CONTAINER (eyes->ebox), eyes->align);
|
||||
gtk_widget_show (eyes->align);
|
||||
|
||||
eyes_read_rc_file (plugin, eyes);
|
||||
|
||||
properties_load(eyes);
|
||||
setup_eyes(eyes);
|
||||
eyes_applet_fill(eyes);
|
||||
properties_load (eyes);
|
||||
setup_eyes (eyes);
|
||||
eyes_applet_fill (eyes);
|
||||
|
||||
return eyes;
|
||||
}
|
||||
|
@ -608,25 +612,25 @@ eyes_construct (XfcePanelPlugin *plugin)
|
|||
{
|
||||
EyesPlugin *eyes;
|
||||
|
||||
xfce_textdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
|
||||
xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
|
||||
|
||||
eyes = eyes_plugin_new (plugin);
|
||||
|
||||
g_signal_connect (plugin, "mode-changed",
|
||||
G_CALLBACK (eyes_mode_changed), eyes);
|
||||
G_CALLBACK (eyes_mode_changed), eyes);
|
||||
|
||||
g_signal_connect (plugin, "size-changed",
|
||||
G_CALLBACK (eyes_set_size), eyes);
|
||||
G_CALLBACK (eyes_set_size), eyes);
|
||||
|
||||
g_signal_connect (plugin, "free-data",
|
||||
G_CALLBACK (eyes_free_data), eyes);
|
||||
G_CALLBACK (eyes_free_data), eyes);
|
||||
|
||||
g_signal_connect (plugin, "save",
|
||||
G_CALLBACK (eyes_write_rc_file), eyes);
|
||||
G_CALLBACK (eyes_write_rc_file), eyes);
|
||||
|
||||
xfce_panel_plugin_menu_show_configure (plugin);
|
||||
g_signal_connect (plugin, "configure-plugin",
|
||||
G_CALLBACK (eyes_properties_dialog), eyes);
|
||||
G_CALLBACK (eyes_properties_dialog), eyes);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (plugin), eyes->ebox);
|
||||
|
||||
|
|
|
@ -24,35 +24,35 @@
|
|||
|
||||
typedef struct
|
||||
{
|
||||
XfcePanelPlugin *plugin;
|
||||
XfcePanelPlugin *plugin;
|
||||
|
||||
GtkWidget *ebox;
|
||||
GtkWidget *ebox;
|
||||
|
||||
/* Properties */
|
||||
gchar *active_theme;
|
||||
/* Properties */
|
||||
gchar *active_theme;
|
||||
|
||||
/* Plugin */
|
||||
GtkWidget *align;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget **eyes;
|
||||
gboolean single_row;
|
||||
guint timeout_id;
|
||||
gint *pointer_last_x;
|
||||
gint *pointer_last_y;
|
||||
/* Plugin */
|
||||
GtkWidget *align;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget **eyes;
|
||||
gboolean single_row;
|
||||
guint timeout_id;
|
||||
gint *pointer_last_x;
|
||||
gint *pointer_last_y;
|
||||
|
||||
/* Theme */
|
||||
GdkPixbuf *eye_image;
|
||||
GdkPixbuf *pupil_image;
|
||||
gchar *theme_dir;
|
||||
gchar *theme_name;
|
||||
gchar *eye_filename;
|
||||
gchar *pupil_filename;
|
||||
gint num_eyes;
|
||||
gint eye_height;
|
||||
gint eye_width;
|
||||
gint pupil_height;
|
||||
gint pupil_width;
|
||||
gint wall_thickness;
|
||||
/* Theme */
|
||||
GdkPixbuf *eye_image;
|
||||
GdkPixbuf *pupil_image;
|
||||
gchar *theme_dir;
|
||||
gchar *theme_name;
|
||||
gchar *eye_filename;
|
||||
gchar *pupil_filename;
|
||||
gint num_eyes;
|
||||
gint eye_height;
|
||||
gint eye_width;
|
||||
gint pupil_height;
|
||||
gint pupil_width;
|
||||
gint wall_thickness;
|
||||
}
|
||||
EyesPlugin;
|
||||
|
||||
|
|
|
@ -35,11 +35,13 @@ gchar *theme_directories[] = {
|
|||
#define NUM_THEME_DIRECTORIES 1
|
||||
|
||||
static void
|
||||
parse_theme_file (EyesPlugin *eyes, FILE *theme_file)
|
||||
parse_theme_file (EyesPlugin *eyes,
|
||||
FILE *theme_file)
|
||||
{
|
||||
gchar line_buf [512]; /* prolly overkill */
|
||||
gchar *token;
|
||||
fgets (line_buf, 512, theme_file);
|
||||
|
||||
while (!feof (theme_file)) {
|
||||
token = strtok (line_buf, "=");
|
||||
if (strncmp (token, "wall-thickness",
|
||||
|
@ -68,20 +70,20 @@ parse_theme_file (EyesPlugin *eyes, FILE *theme_file)
|
|||
if (eyes->eye_filename != NULL)
|
||||
g_free (eyes->eye_filename);
|
||||
eyes->eye_filename = g_strdup_printf ("%s%s",
|
||||
eyes->theme_dir,
|
||||
token);
|
||||
eyes->theme_dir,
|
||||
token);
|
||||
}
|
||||
else if (strncmp (token, "pupil-pixmap", strlen ("pupil-pixmap")) == 0)
|
||||
{
|
||||
token = strtok (NULL, "\"");
|
||||
token = strtok (NULL, "\"");
|
||||
if (eyes->pupil_filename != NULL)
|
||||
g_free (eyes->pupil_filename);
|
||||
eyes->pupil_filename
|
||||
= g_strdup_printf ("%s%s",
|
||||
eyes->theme_dir,
|
||||
token);
|
||||
if (eyes->pupil_filename != NULL)
|
||||
g_free (eyes->pupil_filename);
|
||||
eyes->pupil_filename = g_strdup_printf ("%s%s",
|
||||
eyes->theme_dir,
|
||||
token);
|
||||
}
|
||||
|
||||
fgets (line_buf, 512, theme_file);
|
||||
}
|
||||
}
|
||||
|
@ -92,12 +94,12 @@ void
|
|||
load_theme (EyesPlugin *eyes,
|
||||
const gchar *theme_dir)
|
||||
{
|
||||
FILE* theme_file;
|
||||
FILE* theme_file;
|
||||
gchar *file_name;
|
||||
|
||||
eyes->theme_dir = g_strdup_printf ("%s/", theme_dir);
|
||||
|
||||
file_name = g_strdup_printf("%s%s",theme_dir,"/config");
|
||||
file_name = g_strdup_printf ("%s%s",theme_dir,"/config");
|
||||
theme_file = fopen (file_name, "r");
|
||||
if (theme_file == NULL) {
|
||||
g_error ("Unable to open theme file.");
|
||||
|
@ -109,20 +111,19 @@ load_theme (EyesPlugin *eyes,
|
|||
eyes->theme_name = g_strdup (theme_dir);
|
||||
|
||||
if (eyes->eye_image)
|
||||
g_object_unref (eyes->eye_image);
|
||||
g_object_unref (eyes->eye_image);
|
||||
|
||||
eyes->eye_image = gdk_pixbuf_new_from_file (eyes->eye_filename, NULL);
|
||||
|
||||
if (eyes->pupil_image)
|
||||
g_object_unref (eyes->pupil_image);
|
||||
g_object_unref (eyes->pupil_image);
|
||||
|
||||
eyes->pupil_image = gdk_pixbuf_new_from_file (eyes->pupil_filename, NULL);
|
||||
|
||||
eyes->eye_height = gdk_pixbuf_get_height (eyes->eye_image);
|
||||
eyes->eye_height = gdk_pixbuf_get_height (eyes->eye_image);
|
||||
eyes->eye_width = gdk_pixbuf_get_width (eyes->eye_image);
|
||||
eyes->pupil_height = gdk_pixbuf_get_height (eyes->pupil_image);
|
||||
eyes->pupil_width = gdk_pixbuf_get_width (eyes->pupil_image);
|
||||
|
||||
g_free (file_name);
|
||||
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <gtk/gtk.h>
|
||||
|
||||
void
|
||||
load_theme (EyesPlugin *eyes, const gchar *theme_dir);
|
||||
load_theme (EyesPlugin *eyes,
|
||||
const gchar *theme_dir);
|
||||
|
||||
#endif /* __THEMES_H__ */
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
Default_tinydir = $(datadir)/xfce4/eyes/themes/Default-tiny
|
||||
|
||||
Default_tiny_DATA = \
|
||||
Default-tiny-eye.png \
|
||||
Default-tiny-pupil.png \
|
||||
Default-tiny-eye.png \
|
||||
Default-tiny-pupil.png \
|
||||
config
|
||||
|
||||
EXTRA_DIST = $(Default_tiny_DATA)
|
||||
|
|
|
@ -2,7 +2,7 @@ SUBDIRS = \
|
|||
Bizarre \
|
||||
Bloodshot \
|
||||
Default \
|
||||
Default-tiny \
|
||||
Default-tiny \
|
||||
Horrid \
|
||||
Tango
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ Tango_DATA = \
|
|||
tango-pupil.png \
|
||||
config
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(Tango_DATA)
|
||||
EXTRA_DIST = $(Tango_DATA)
|
||||
|
||||
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
|
||||
|
|
Loading…
Reference in a new issue