clock instant-apply patch
- From: fflewddur <fflewddur dropline net>
- To: Desktop-Devel List <desktop-devel-list gnome org>
- Subject: clock instant-apply patch
- Date: 18 Feb 2002 11:07:30 -0500
this patch updates the clock applet's properties dialog to use
instant-apply settings. could someone review/commit? thanks!
todd
? clock.patch
Index: applets/gen_util/ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-panel/applets/gen_util/ChangeLog,v
retrieving revision 1.328
diff -u -r1.328 ChangeLog
--- applets/gen_util/ChangeLog 2002/02/18 04:00:11 1.328
+++ applets/gen_util/ChangeLog 2002/02/18 15:27:32
@@ -1,3 +1,8 @@
+2002-02-18 Todd Kulesza <fflewddur dropline net>
+
+ * clock.c:
+ made properties dialog instant-apply.
+
2002-02-17 Alexander Larsson <alla lysator liu se>
* tasklist.c:
Index: applets/gen_util/clock.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/applets/gen_util/clock.c,v
retrieving revision 1.57
diff -u -r1.57 clock.c
--- applets/gen_util/clock.c 2002/02/16 20:55:34 1.57
+++ applets/gen_util/clock.c 2002/02/18 15:27:34
@@ -57,6 +57,7 @@
gboolean prop_internettime;
gboolean prop_gmt_time;
gboolean prop_showtooltip;
+ GtkTooltips *tooltips;
};
typedef struct {
@@ -358,6 +359,9 @@
cd->timeout = g_timeout_add (cd->timeouttime,
clock_timeout_callback,
cd);
+
+ cd->tooltips = gtk_tooltips_new();
+ gtk_tooltips_enable (cd->tooltips);
}
/* this is when the panel orientation changes */
@@ -613,23 +617,26 @@
}
static void
-apply_properties (GtkWidget * widget, gint button_num, gpointer data)
+refresh_clock (ClockData *cd)
{
- ClockData *cd = data;
time_t current_time;
- struct tm *tm;
-
- cd->hourformat = cd->prop_hourformat;
- cd->showdate = cd->prop_showdate;
- cd->unixtime = cd->prop_unixtime;
- cd->internettime = cd->prop_internettime;
- cd->gmt_time = cd->prop_gmt_time;
- cd->showtooltip = cd->prop_showtooltip;
-
+
/* Call the clock's update function so that it paints its first state */
time (¤t_time);
(*cd->update_func) (cd, current_time);
+ if(!cd->showtooltip || cd->unixtime || cd->internettime)
+ gtk_tooltips_set_tip (cd->tooltips, GTK_WIDGET (cd->applet), _("Clock"), NULL);
+}
+
+static void
+refresh_clock_timeout(ClockData *cd)
+{
+ time_t current_time;
+ struct tm *tm;
+
+ refresh_clock (cd);
+
g_source_remove (cd->timeout);
/* Install timeout handler */
@@ -648,21 +655,6 @@
cd->timeout = g_timeout_add (cd->timeouttime,
clock_timeout_callback,
cd);
-#ifdef FIXME
- if(!cd->showtooltip || cd->unixtime || cd->internettime)
- applet_widget_set_tooltip(APPLET_WIDGET(cd->applet), "");
-#endif
-
- /* gtk_widget_queue_resize (cd->clockw);*/
-}
-
-static void
-close_properties (GtkWidget *w,
- gpointer data)
-{
- ClockData *cd = data;
-
- cd->props = NULL;
}
static void
@@ -673,8 +665,9 @@
if (GTK_TOGGLE_BUTTON (w)->active) {
ClockData *cd = gtk_object_get_user_data (GTK_OBJECT (w));
- cd->prop_hourformat = GPOINTER_TO_INT (data);
- gnome_property_box_changed (GNOME_PROPERTY_BOX (cd->props));
+ cd->hourformat = GPOINTER_TO_INT (data);
+
+ refresh_clock (cd);
}
}
@@ -683,9 +676,10 @@
gpointer data)
{
ClockData *cd = data;
-
- cd->prop_showdate = GTK_TOGGLE_BUTTON (w)->active;
- gnome_property_box_changed (GNOME_PROPERTY_BOX (cd->props));
+
+ cd->showdate = GTK_TOGGLE_BUTTON (w)->active;
+
+ refresh_clock (cd);
}
static void
@@ -701,8 +695,9 @@
{
ClockData *cd = data;
- cd->prop_internettime = GTK_TOGGLE_BUTTON (w)->active;
- gnome_property_box_changed (GNOME_PROPERTY_BOX (cd->props));
+ cd->internettime = GTK_TOGGLE_BUTTON (w)->active;
+
+ refresh_clock_timeout (cd);
}
static void
@@ -710,9 +705,10 @@
gpointer data)
{
ClockData *cd = data;
+
+ cd->unixtime = GTK_TOGGLE_BUTTON (w)->active;
- cd->prop_unixtime = GTK_TOGGLE_BUTTON (w)->active;
- gnome_property_box_changed (GNOME_PROPERTY_BOX (cd->props));
+ refresh_clock_timeout (cd);
}
static void
@@ -721,8 +717,9 @@
{
ClockData *cd = data;
- cd->prop_gmt_time = GTK_TOGGLE_BUTTON (w)->active;
- gnome_property_box_changed (GNOME_PROPERTY_BOX (cd->props));
+ cd->gmt_time = GTK_TOGGLE_BUTTON (w)->active;
+
+ refresh_clock_timeout (cd);
}
static void
@@ -730,9 +727,20 @@
gpointer data)
{
ClockData *cd = data;
+
+ cd->showtooltip = GTK_TOGGLE_BUTTON (w)->active;
+
+ refresh_clock (cd);
+}
- cd->prop_showtooltip = GTK_TOGGLE_BUTTON (w)->active;
- gnome_property_box_changed (GNOME_PROPERTY_BOX (cd->props));
+static void
+properties_close_cb(GtkWidget *widget, gint arg, gpointer data)
+{
+
+ if (arg == GTK_RESPONSE_CLOSE)
+ gtk_widget_destroy (widget);
+
+ return;
}
static void
@@ -760,10 +768,7 @@
return;
}
- cd->props = gnome_property_box_new();
- gtk_window_set_title (GTK_WINDOW (cd->props),
- _("Clock properties"));
- gtk_window_set_wmclass (GTK_WINDOW (cd->props), "clock", "Clock");
+ cd->props = gtk_dialog_new_with_buttons (_("Clock Properties"), NULL, 0, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
pixbuf = NULL;
file = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP, "gnome-clock.png", TRUE, NULL);
@@ -778,7 +783,8 @@
}
hbox = gtk_hbox_new (FALSE, GNOME_PAD);
-
+ gtk_container_set_border_width (GTK_CONTAINER(hbox), 5);
+
hour_frame = gtk_frame_new (_("Time Format"));
gtk_container_set_border_width (GTK_CONTAINER (hour_frame), GNOME_PAD);
gtk_box_pack_start (GTK_BOX (hbox), hour_frame, FALSE, FALSE, 0);
@@ -936,16 +942,13 @@
gtk_widget_show (hour_frame);
gtk_widget_show (hbox);
- gnome_property_box_append_page (GNOME_PROPERTY_BOX (cd->props), hbox,
- gtk_label_new (_("Clock")));
- gtk_signal_connect (GTK_OBJECT (cd->props), "apply",
- GTK_SIGNAL_FUNC (apply_properties), cd);
- gtk_signal_connect (GTK_OBJECT (cd->props), "destroy",
- GTK_SIGNAL_FUNC (close_properties), cd);
- gtk_signal_connect (GTK_OBJECT (cd->props), "help",
- GTK_SIGNAL_FUNC (phelp_cb),
- "index.html#CLOCK-PREFS");
-
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (cd->props)->vbox), hbox, FALSE, FALSE, 0);
+
+ g_signal_connect (G_OBJECT (cd->props), "destroy",
+ G_CALLBACK (gtk_widget_destroyed), &(cd->props));
+ g_signal_connect (G_OBJECT (cd->props), "response",
+ G_CALLBACK (properties_close_cb), NULL);
+
gtk_widget_show (cd->props);
}
@@ -961,14 +964,6 @@
g_warning ("help error: %s\n", error->message);
g_error_free (error);
}
-}
-
-static void
-phelp_cb (GtkWidget *w, gint tab, gpointer data)
-{
-#ifdef FIXME
- help_cb (NULL, data);
-#endif
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]