Commit 19764219 authored by Jim Krehl's avatar Jim Krehl
Browse files

svn path=/branches/version-2/; revision=168



svn path=/branches/version-2/; revision=168
parent f6186237
......@@ -113,7 +113,6 @@ static void create_system_section (MainMenuUI *);
static void create_status_section (MainMenuUI *);
static void create_more_buttons (MainMenuUI *);
static void set_panel_button_active (MainMenuUI *, gboolean);
static void select_page (MainMenuUI *, gint);
static void update_limits (MainMenuUI *);
static void connect_to_tile_triggers (MainMenuUI *, TileTable *);
......@@ -125,6 +124,7 @@ static void bind_beagle_search_key (MainMenuUI *);
static void launch_search (MainMenuUI *);
static void grab_pointer_and_keyboard (MainMenuUI *, guint32);
static void panel_button_clicked_cb (GtkButton *, gpointer);
static gboolean panel_button_button_press_cb (GtkWidget *, GdkEventButton *, gpointer);
static void panel_button_drag_data_rcv_cb (GtkWidget *, GdkDragContext *, gint, gint,
GtkSelectionData *, guint, guint, gpointer);
......@@ -338,6 +338,10 @@ create_panel_button (MainMenuUI *this)
gtk_container_remove (
GTK_CONTAINER (button_parent), priv->panel_buttons [i]);
g_signal_connect (
G_OBJECT (priv->panel_buttons [i]), "clicked",
G_CALLBACK (panel_button_clicked_cb), this);
g_signal_connect (
G_OBJECT (priv->panel_buttons [i]), "button_press_event",
G_CALLBACK (panel_button_button_press_cb), this);
......@@ -681,24 +685,6 @@ create_more_buttons (MainMenuUI *this)
}
}
static void
set_panel_button_active (MainMenuUI *this, gboolean active)
{
MainMenuUIPrivate *priv = PRIVATE (this);
if (active) {
gtk_window_present_with_time (
GTK_WINDOW (priv->slab_window), gtk_get_current_event_time ());
gtk_widget_set_state (priv->panel_button, GTK_STATE_ACTIVE);
gtk_event_box_set_visible_window (GTK_EVENT_BOX (priv->panel_button), TRUE);
}
else {
gtk_widget_hide (priv->slab_window);
gtk_widget_set_state (priv->panel_button, GTK_STATE_NORMAL);
gtk_event_box_set_visible_window (GTK_EVENT_BOX (priv->panel_button), FALSE);
}
}
static void
select_page (MainMenuUI *this, gint page_id)
{
......@@ -810,10 +796,12 @@ connect_to_tile_triggers (MainMenuUI *this, TileTable *table)
static void
hide_slab_if_urgent_close (MainMenuUI *this)
{
MainMenuUIPrivate *priv = PRIVATE (this);
if (! GPOINTER_TO_INT (libslab_get_gconf_value (URGENT_CLOSE_GCONF_KEY)))
return;
set_panel_button_active (this, FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->panel_button), FALSE);
}
static void
......@@ -1071,26 +1059,52 @@ exit:
xmlFreeDoc (doc);
}
static gboolean
panel_button_button_press_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
static void
panel_button_clicked_cb (GtkButton *button, gpointer user_data)
{
MainMenuUI *this = MAIN_MENU_UI (user_data);
MainMenuUIPrivate *priv = PRIVATE (this);
DoubleClickDetector *dcd;
GtkToggleButton *toggle = GTK_TOGGLE_BUTTON (button);
DoubleClickDetector *detector;
GTimeVal t_curr;
guint32 t_curr_ms;
if (event->button == 1) {
dcd = DOUBLE_CLICK_DETECTOR (
g_object_get_data (G_OBJECT (widget), "double-click-detector"));
gboolean visible;
if (! double_click_detector_is_double_click (dcd, event->time, TRUE))
set_panel_button_active (this, ! GTK_WIDGET_VISIBLE (priv->slab_window));
return TRUE;
detector = DOUBLE_CLICK_DETECTOR (
g_object_get_data (G_OBJECT (toggle), "double-click-detector"));
g_get_current_time (& t_curr);
t_curr_ms = 1000 * t_curr.tv_sec + t_curr.tv_usec / 1000;
visible = GTK_WIDGET_VISIBLE (priv->slab_window);
if (! double_click_detector_is_double_click (detector, t_curr_ms, TRUE)) {
if (! visible)
gtk_window_present_with_time (GTK_WINDOW (priv->slab_window), t_curr_ms);
else
gtk_widget_hide (priv->slab_window);
visible = GTK_WIDGET_VISIBLE (priv->slab_window);
}
else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->panel_button), visible);
}
static gboolean
panel_button_button_press_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
{
MainMenuUIPrivate *priv = PRIVATE (user_data);
if (event->button != 1)
g_signal_stop_emission_by_name (widget, "button_press_event");
else if (! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->panel_button)))
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->panel_button), TRUE);
else
/* do nothing */ ;
return FALSE;
}
......@@ -1187,9 +1201,9 @@ slab_window_expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer user_d
cairo_set_source_rgb (
cr,
widget->style->bg [GTK_STATE_PRELIGHT].red / 65535.0,
widget->style->bg [GTK_STATE_PRELIGHT].green / 65535.0,
widget->style->bg [GTK_STATE_PRELIGHT].blue / 65535.0);
widget->style->bg [GTK_STATE_NORMAL].red / 65535.0,
widget->style->bg [GTK_STATE_NORMAL].green / 65535.0,
widget->style->bg [GTK_STATE_NORMAL].blue / 65535.0);
cairo_fill_preserve (cr);
......@@ -1259,18 +1273,18 @@ slab_window_expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer user_d
static gboolean
slab_window_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
{
MainMenuUI *this = MAIN_MENU_UI (user_data);
MainMenuUIPrivate *priv = PRIVATE (user_data);
switch (event->keyval) {
case GDK_Escape:
set_panel_button_active (this, FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->panel_button), FALSE);
return TRUE;
case GDK_W:
case GDK_w:
if (event->state & GDK_CONTROL_MASK) {
set_panel_button_active (this, FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->panel_button), FALSE);
return TRUE;
}
......@@ -1287,31 +1301,17 @@ slab_window_button_press_cb (GtkWidget *widget, GdkEventButton *event, gpointer
MainMenuUIPrivate *priv = PRIVATE (this);
GdkWindow *ptr_window;
DoubleClickDetector *dcd;
ptr_window = gdk_window_at_pointer (NULL, NULL);
if (ptr_window == priv->slab_window->window)
return FALSE;
/* If the external click happens in the panel button then it's the user turning
* off the menu (or double-clicking. */
if (priv->slab_window->window != ptr_window) {
hide_slab_if_urgent_close (this);
if (ptr_window == priv->panel_button->window) {
dcd = DOUBLE_CLICK_DETECTOR (
g_object_get_data (G_OBJECT (priv->panel_button), "double-click-detector"));
if (! double_click_detector_is_double_click (dcd, event->time, TRUE))
set_panel_button_active (this, FALSE);
return FALSE;
return TRUE;
}
hide_slab_if_urgent_close (this);
return TRUE;
return FALSE;
}
static void
......@@ -1507,15 +1507,22 @@ more_button_clicked_cb (GtkButton *button, gpointer user_data)
MainMenuUI *this = MAIN_MENU_UI (user_data);
MainMenuUIPrivate *priv = PRIVATE (this);
DoubleClickDetector *dcd;
DoubleClickDetector *detector;
GTimeVal current_time;
guint32 current_time_millis;
GnomeDesktopItem *ditem;
gchar *ditem_id;
dcd = DOUBLE_CLICK_DETECTOR (g_object_get_data (G_OBJECT (button), "double-click-detector"));
detector = DOUBLE_CLICK_DETECTOR (
g_object_get_data (G_OBJECT (button), "double-click-detector"));
g_get_current_time (& current_time);
current_time_millis = 1000 * current_time.tv_sec + current_time.tv_usec / 1000;
if (! double_click_detector_is_double_click (dcd, gtk_get_current_event_time (), TRUE)) {
if (! double_click_detector_is_double_click (detector, current_time_millis, TRUE)) {
if (GTK_WIDGET (button) == priv->more_button [MORE_APPS_BUTTON])
ditem_id = libslab_get_gconf_value (APP_BROWSER_GCONF_KEY);
else
......@@ -1541,7 +1548,8 @@ search_cmd_notify_cb (GConfClient *client, guint conn_id,
static void
panel_menu_open_cb (BonoboUIComponent *component, gpointer user_data, const gchar *verb)
{
set_panel_button_active (MAIN_MENU_UI (user_data), TRUE);
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (PRIVATE (user_data)->panel_button), TRUE);
}
static void
......@@ -1626,7 +1634,8 @@ panel_applet_change_background_cb (PanelApplet *applet, PanelAppletBackgroundTyp
static void
slab_window_tomboy_bindkey_cb (gchar *key_string, gpointer user_data)
{
set_panel_button_active (MAIN_MENU_UI (user_data), TRUE);
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (PRIVATE (user_data)->panel_button), TRUE);
}
static void
......
......@@ -994,71 +994,60 @@
<property name="right_padding">0</property>
<child>
<widget class="GtkEventBox" id="slab-main-menu-panel-button-top">
<widget class="GtkToggleButton" id="slab-main-menu-panel-button-top">
<property name="visible">True</property>
<property name="visible_window">False</property>
<property name="above_child">False</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">False</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<child>
<widget class="GtkAlignment" id="alignment27">
<widget class="GtkHBox" id="panel-button-inner-container">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">3</property>
<property name="right_padding">3</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
<widget class="GtkHBox" id="hbox44">
<widget class="GtkImage" id="panel-button-icon">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
<widget class="GtkImage" id="image45">
<property name="visible">True</property>
<property name="icon_size">2</property>
<property name="icon_name">gnome-fs-client</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<property name="icon_size">1</property>
<property name="icon_name">gnome-fs-client</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label94">
<property name="visible">True</property>
<property name="label" translatable="yes">Computer</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="panel-button-label">
<property name="visible">True</property>
<property name="label" translatable="yes">Computer</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
......@@ -1085,71 +1074,60 @@
<property name="right_padding">0</property>
<child>
<widget class="GtkEventBox" id="slab-main-menu-panel-button-left">
<widget class="GtkToggleButton" id="slab-main-menu-panel-button-left">
<property name="visible">True</property>
<property name="visible_window">False</property>
<property name="above_child">False</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">False</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<child>
<widget class="GtkAlignment" id="alignment28">
<widget class="GtkVBox" id="vbox42">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">3</property>
<property name="bottom_padding">3</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
<widget class="GtkVBox" id="vbox42">
<widget class="GtkLabel" id="label91">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
<widget class="GtkLabel" id="label91">
<property name="visible">True</property>
<property name="label" translatable="yes">Computer</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">90</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<property name="label" translatable="yes">Computer</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">90</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkImage" id="image42">
<property name="visible">True</property>
<property name="icon_size">2</property>
<property name="icon_name">gnome-fs-client</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkImage" id="image42">
<property name="visible">True</property>
<property name="icon_size">1</property>
<property name="icon_name">gnome-fs-client</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
......@@ -1176,71 +1154,60 @@
<property name="right_padding">0</property>
<child>
<widget class="GtkEventBox" id="slab-main-menu-panel-button-right">
<widget class="GtkToggleButton" id="slab-main-menu-panel-button-right">
<property name="visible">True</property>
<property name="visible_window">False</property>
<property name="above_child">False</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">False</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<child>
<widget class="GtkAlignment" id="alignment29">
<widget class="GtkVBox" id="vbox43">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">3</property>
<property name="bottom_padding">3</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
<widget class="GtkVBox" id="vbox46">
<widget class="GtkImage" id="image43">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
<widget class="GtkImage" id="image46">
<property name="visible">True</property>
<property name="icon_size">2</property>
<property name="icon_name">gnome-fs-client</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<property name="icon_size">1</property>
<property name="icon_name">gnome-fs-client</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label95">
<property name="visible">True</property>
<property name="label" translatable="yes">Computer</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">270</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label92">
<property name="visible">True</property>
<property name="label" translatable="yes">Computer</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">270</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
......@@ -1267,71 +1234,60 @@
<property name="right_padding">0</property>
<child>
<widget class="GtkEventBox" id="slab-main-menu-panel-button-bottom">
<widget class="GtkToggleButton" id="slab-main-menu-panel-button-bottom">
<property name="visible">True</property>
<property name="visible_window">False</property>
<property name="above_child">False</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">False</property>
<property name="active">False</property>
<property name="inconsistent">False</property>