quick-lounge-applet r260 - in trunk: . data/ui src
- From: paobac svn gnome org
- To: svn-commits-list gnome org
- Subject: quick-lounge-applet r260 - in trunk: . data/ui src
- Date: Wed, 4 Feb 2009 16:01:19 +0000 (UTC)
Author: paobac
Date: Wed Feb 4 16:01:19 2009
New Revision: 260
URL: http://svn.gnome.org/viewvc/quick-lounge-applet?rev=260&view=rev
Log:
2009-02-04 Paolo Bacchilega <paobac svn gnome org>
* src/xstuff.c:
* src/xstuff.h:
removed the animation when launching the application.
* src/quick-lounge.c:
* src/quick-box.h:
* src/quick-box.c:
* src/Makefile.am:
* src/gtk-utils.h:
* src/gtk-utils.c:
* src/file-utils.h:
* src/file-utils.c:
* src/dlg-properties.c:
Fixed bug #171739 â support launching apps by dropping files
on them
* src/quick-desktop-entry-dialog.c:
* data/ui/desktop-entry-editor.ui: fixed label mnemonics.
Removed:
trunk/src/xstuff.c
trunk/src/xstuff.h
Modified:
trunk/ChangeLog
trunk/data/ui/desktop-entry-editor.ui
trunk/src/Makefile.am
trunk/src/dlg-properties.c
trunk/src/file-utils.c
trunk/src/file-utils.h
trunk/src/gtk-utils.c
trunk/src/gtk-utils.h
trunk/src/quick-box.c
trunk/src/quick-box.h
trunk/src/quick-desktop-entry-dialog.c
trunk/src/quick-lounge.c
Modified: trunk/data/ui/desktop-entry-editor.ui
==============================================================================
--- trunk/data/ui/desktop-entry-editor.ui (original)
+++ trunk/data/ui/desktop-entry-editor.ui Wed Feb 4 16:01:19 2009
@@ -41,7 +41,7 @@
<property name="column_spacing">6</property>
<property name="row_spacing">6</property>
<child>
- <object class="GtkLabel" id="label1">
+ <object class="GtkLabel" id="type_label">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes" comments="Use the same translation used by the GNOME Panel in the Launcher Properties dialog."><b>_Type:</b></property>
@@ -56,6 +56,7 @@
<property name="label" translatable="yes" comments="Use the same translation used by the GNOME Panel in the Launcher Properties dialog."><b>_Name:</b></property>
<property name="use_markup">True</property>
<property name="use_underline">True</property>
+ <property name="mnemonic_widget">name_entry</property>
</object>
<packing>
<property name="top_attach">1</property>
@@ -69,6 +70,7 @@
<property name="label" translatable="yes" comments="Use the same translation used by the GNOME Panel in the Launcher Properties dialog."><b>_Command:</b></property>
<property name="use_markup">True</property>
<property name="use_underline">True</property>
+ <property name="mnemonic_widget">exec_entry</property>
</object>
<packing>
<property name="top_attach">2</property>
@@ -82,6 +84,7 @@
<property name="label" translatable="yes" comments="Use the same translation used by the GNOME Panel in the Launcher Properties dialog."><b>C_omment:</b></property>
<property name="use_markup">True</property>
<property name="use_underline">True</property>
+ <property name="mnemonic_widget">comment_entry</property>
</object>
<packing>
<property name="top_attach">3</property>
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Wed Feb 4 16:01:19 2009
@@ -32,8 +32,6 @@
quick-lounge.h \
quick-separator.c \
quick-separator.h \
- typedefs.h \
- xstuff.c \
- xstuff.h
+ typedefs.h
quick_lounge_applet_LDADD = $(QL_LIBS) $(X_LIBS)
Modified: trunk/src/dlg-properties.c
==============================================================================
--- trunk/src/dlg-properties.c (original)
+++ trunk/src/dlg-properties.c Wed Feb 4 16:01:19 2009
@@ -688,56 +688,6 @@
}
-static GtkWidget *
-get_button_from_uri (QuickBox *quick_box,
- const char *uri1)
-{
- GList *children, *scan;
- GtkWidget *retval = NULL;
-
- children = gtk_container_get_children (GTK_CONTAINER (quick_box));
- for (scan = children; scan; scan = scan->next) {
- GtkWidget *child_widget = scan->data;
- const char *uri2;
-
- uri2 = g_object_get_data (G_OBJECT (child_widget), "uri");
- if (uri2 == NULL)
- continue;
- if (strcmp (uri1, uri2) == 0) {
- retval = child_widget;
- break;
- }
- }
- g_list_free (children);
-
- return retval;
-}
-
-
-static int
-get_child_position (QuickBox *quick_box,
- GtkWidget *widget)
-{
- GList *children, *scan;
- gboolean found = FALSE;
- int pos;
-
- children = gtk_container_get_children (GTK_CONTAINER (quick_box));
- for (pos = 0, scan = children; scan; pos++, scan = scan->next) {
- GtkWidget *child_widget = scan->data;
- if (child_widget == widget) {
- found = TRUE;
- break;
- }
- }
-
- if (found)
- return pos;
- else
- return -1;
-}
-
-
static void
drag_data_received (GtkWidget *widget,
GdkDragContext *context,
@@ -829,13 +779,13 @@
* the laucher has been dragged from the properties
* dialog: change launcher position. */
- button = get_button_from_uri (quick_box, uri);
+ button = quick_box_get_child_from_uri (quick_box, uri);
g_free (uri);
if (button == NULL)
continue;
- button_pos = get_child_position (quick_box, button);
+ button_pos = quick_box_get_child_position (quick_box, button);
if (button_pos == -1)
continue;
Modified: trunk/src/file-utils.c
==============================================================================
--- trunk/src/file-utils.c (original)
+++ trunk/src/file-utils.c Wed Feb 4 16:01:19 2009
@@ -23,8 +23,11 @@
#include <config.h>
#include <sys/types.h>
#include <unistd.h>
+#include <gconf/gconf-client.h>
#include <glib/gi18n.h>
+#include <gio/gdesktopappinfo.h>
#include "file-utils.h"
+#include "gtk-utils.h"
/* -- path_list_async_new implementation -- */
@@ -665,3 +668,32 @@
return TRUE;
}
+
+
+void
+_g_desktop_entry_launch (GKeyFile *desktop_entry,
+ GtkWidget *source,
+ GList *files)
+{
+ GKeyFile *key_file;
+ char *path;
+ GDesktopAppInfo *app_info;
+ GdkAppLaunchContext *context;
+ GError *error = NULL;
+
+ key_file = _g_key_file_dup (desktop_entry);
+ path = g_key_file_get_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_PATH, NULL);
+ if (path == NULL)
+ g_key_file_set_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_PATH, g_get_home_dir ());
+ g_free (path);
+
+ app_info = g_desktop_app_info_new_from_keyfile (key_file);
+ context = gdk_app_launch_context_new ();
+
+ if (! g_app_info_launch_uris (G_APP_INFO (app_info), files, G_APP_LAUNCH_CONTEXT (context), &error))
+ _gtk_error_dialog_from_gerror_run (NULL, _("Could not launch the application"), &error);
+
+ g_object_unref (context);
+ g_object_unref (app_info);
+ g_key_file_free (key_file);
+}
Modified: trunk/src/file-utils.h
==============================================================================
--- trunk/src/file-utils.h (original)
+++ trunk/src/file-utils.h Wed Feb 4 16:01:19 2009
@@ -27,8 +27,10 @@
#include <sys/types.h>
#include <glib.h>
#include <gio/gio.h>
+#include <gtk/gtk.h>
#include "typedefs.h"
+
typedef void (*PathListDoneFunc) (GList *files, GList *dirs, GError *error, gpointer data);
gboolean uri_is_file (const char *uri);
@@ -69,5 +71,8 @@
void _g_key_file_cleanup (GKeyFile *file);
gboolean _g_desktop_entry_equal (GKeyFile *file1,
GKeyFile *file2);
+void _g_desktop_entry_launch (GKeyFile *desktop_entry,
+ GtkWidget *source,
+ GList *files);
#endif /* FILE_UTILS_H */
Modified: trunk/src/gtk-utils.c
==============================================================================
--- trunk/src/gtk-utils.c (original)
+++ trunk/src/gtk-utils.c Wed Feb 4 16:01:19 2009
@@ -306,19 +306,24 @@
void
-_gtk_error_dialog_from_gerror_run (GtkWindow *parent,
- GError **gerror)
+_gtk_error_dialog_from_gerror_run (GtkWindow *parent,
+ const char *message,
+ GError **gerror)
{
GtkWidget *d;
g_return_if_fail (*gerror != NULL);
- d = gtk_message_dialog_new (parent,
- GTK_DIALOG_MODAL,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- "%s", (*gerror)->message);
+
+ d = _gtk_message_dialog_new (parent,
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_DIALOG_ERROR,
+ message,
+ (*gerror)->message,
+ GTK_STOCK_OK, GTK_RESPONSE_OK,
+ NULL);
gtk_dialog_run (GTK_DIALOG (d));
+
gtk_widget_destroy (d);
g_clear_error (gerror);
}
Modified: trunk/src/gtk-utils.h
==============================================================================
--- trunk/src/gtk-utils.h (original)
+++ trunk/src/gtk-utils.h Wed Feb 4 16:01:19 2009
@@ -25,70 +25,63 @@
#include <gtk/gtk.h>
-GtkWidget * _gtk_image_new_from_xpm_data (char *xpm_data[]);
-GtkWidget * _gtk_image_new_from_inline (const guint8 *data);
-
-gchar* _gtk_request_dialog_run (GtkWindow *parent,
- GtkDialogFlags flags,
- const char *message,
- const char *default_value,
- int max_length,
- const char *no_button_text,
- const char *yes_button_text);
-
-void _gtk_error_dialog_from_gerror_run (GtkWindow *parent,
- GError **gerror);
-
-void _gtk_error_dialog_run (GtkWindow *parent,
- const gchar *format,
- ...) G_GNUC_PRINTF (2, 3);
-
-void _gtk_info_dialog_run (GtkWindow *parent,
- const gchar *format,
- ...) G_GNUC_PRINTF (2, 3);
-
-void _gtk_entry_set_locale_text (GtkEntry *entry,
- const char *text);
-
-char * _gtk_entry_get_locale_text (GtkEntry *entry);
-
-void _gtk_label_set_locale_text (GtkLabel *label,
- const char *text);
-
-char * _gtk_label_get_locale_text (GtkLabel *label);
-
-int _gtk_icon_get_pixel_size (GtkWidget *widget,
- GtkIconSize size);
-
-char * panel_find_icon (GtkIconTheme *icon_theme,
- const char *icon_name,
- int size);
-GdkPixbuf * create_missing_pixbuf (GtkIconTheme *theme,
- int preffered_size);
-GdkPixbuf * create_pixbuf (GtkIconTheme *icon_theme,
- const char *icon_name,
- int icon_size,
- gboolean with_fallback);
-GdkPixbuf * create_pixbuf_or_missing (GtkIconTheme *theme,
- const char *icon_name,
- int preffered_size);
-GtkWidget * create_image (GtkIconTheme *icon_theme,
- const char *icon_path,
- int icon_size);
-
-GList * _gtk_container_get_all_children (GtkContainer *container);
-
-int _gtk_container_get_n_children (GtkContainer *container);
-
-GtkBuilder *
- _gtk_builder_new_from_file (const char *filename);
-GtkWidget *
- _gtk_builder_get_widget (GtkBuilder *builder,
- const char *name);
-void _gtk_show_help (GtkWindow *parent,
- const char *manual,
- const char *section);
-GtkWidget * _gtk_combo_box_new_with_texts (const char *first_text,
- ...);
+GtkWidget * _gtk_image_new_from_xpm_data (char *xpm_data[]);
+GtkWidget * _gtk_image_new_from_inline (const guint8 *data);
+GtkWidget* _gtk_message_dialog_new (GtkWindow *parent,
+ GtkDialogFlags flags,
+ const char *stock_id,
+ const char *message,
+ const char *secondary_message,
+ const gchar *first_button_text,
+ ...);
+gchar* _gtk_request_dialog_run (GtkWindow *parent,
+ GtkDialogFlags flags,
+ const char *message,
+ const char *default_value,
+ int max_length,
+ const char *no_button_text,
+ const char *yes_button_text);
+void _gtk_error_dialog_from_gerror_run (GtkWindow *parent,
+ const char *message,
+ GError **gerror);
+void _gtk_error_dialog_run (GtkWindow *parent,
+ const gchar *format,
+ ...) G_GNUC_PRINTF (2, 3);
+void _gtk_info_dialog_run (GtkWindow *parent,
+ const gchar *format,
+ ...) G_GNUC_PRINTF (2, 3);
+void _gtk_entry_set_locale_text (GtkEntry *entry,
+ const char *text);
+char * _gtk_entry_get_locale_text (GtkEntry *entry);
+void _gtk_label_set_locale_text (GtkLabel *label,
+ const char *text);
+char * _gtk_label_get_locale_text (GtkLabel *label);
+int _gtk_icon_get_pixel_size (GtkWidget *widget,
+ GtkIconSize size);
+char * panel_find_icon (GtkIconTheme *icon_theme,
+ const char *icon_name,
+ int size);
+GdkPixbuf * create_missing_pixbuf (GtkIconTheme *theme,
+ int preffered_size);
+GdkPixbuf * create_pixbuf (GtkIconTheme *icon_theme,
+ const char *icon_name,
+ int icon_size,
+ gboolean with_fallback);
+GdkPixbuf * create_pixbuf_or_missing (GtkIconTheme *theme,
+ const char *icon_name,
+ int preffered_size);
+GtkWidget * create_image (GtkIconTheme *icon_theme,
+ const char *icon_path,
+ int icon_size);
+GList * _gtk_container_get_all_children (GtkContainer *container);
+int _gtk_container_get_n_children (GtkContainer *container);
+GtkBuilder * _gtk_builder_new_from_file (const char *filename);
+GtkWidget * _gtk_builder_get_widget (GtkBuilder *builder,
+ const char *name);
+void _gtk_show_help (GtkWindow *parent,
+ const char *manual,
+ const char *section);
+GtkWidget * _gtk_combo_box_new_with_texts (const char *first_text,
+ ...);
#endif /* _GTK_UTILS_H */
Modified: trunk/src/quick-box.c
==============================================================================
--- trunk/src/quick-box.c (original)
+++ trunk/src/quick-box.c Wed Feb 4 16:01:19 2009
@@ -24,15 +24,12 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
-#include <gio/gdesktopappinfo.h>
#include <gtk/gtk.h>
-#include <gconf/gconf-client.h>
#include "dlg-properties.h"
#include "quick-box.h"
#include "quick-button.h"
#include "quick-separator.h"
#include "gtk-utils.h"
-#include "xstuff.h"
#define ICON_SPACING 1 /* spacing between icons */
#define ICON_SIZE_PANEL 22 /* icons size on panels */
@@ -134,7 +131,8 @@
col++;
col++;
row = 0;
- } else {
+ }
+ else {
row++;
if (row == quick_box->priv->rows) {
col++;
@@ -964,57 +962,13 @@
static gboolean
-enable_animations (void)
-{
- GConfClient *client = gconf_client_get_default ();
- gboolean global_animation, panel_animation;
-
- global_animation = gconf_client_get_bool (client, "/desktop/gnome/interface/enable_animations", NULL);
- panel_animation = gconf_client_get_bool (client, "/apps/panel/global/enable_animations", NULL);
-
- return global_animation && panel_animation;
-}
-
-
-static void
-_g_desktop_entry_launch (GKeyFile *desktop_entry,
- GtkWidget *source)
-{
- GKeyFile *key_file;
- char *path;
- GDesktopAppInfo *app_info;
- GdkAppLaunchContext *context;
- GError *error = NULL;
-
- key_file = _g_key_file_dup (desktop_entry);
- path = g_key_file_get_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_PATH, NULL);
- if (path == NULL)
- g_key_file_set_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_PATH, g_get_home_dir ());
- g_free (path);
-
- app_info = g_desktop_app_info_new_from_keyfile (key_file);
- context = gdk_app_launch_context_new ();
-
- if ((source != NULL) && enable_animations ())
- xstuff_zoom_animate (source, NULL);
-
- if (! g_app_info_launch (G_APP_INFO (app_info), NULL, G_APP_LAUNCH_CONTEXT (context), &error))
- _gtk_error_dialog_from_gerror_run (NULL, &error);
-
- g_object_unref (context);
- g_object_unref (app_info);
- g_key_file_free (key_file);
-}
-
-
-static gboolean
item_activated (QuickButton *button)
{
GKeyFile *desktop_entry;
desktop_entry = g_object_get_data (G_OBJECT (button), "desktop_entry");
if (desktop_entry != NULL)
- _g_desktop_entry_launch (desktop_entry, GTK_WIDGET (button));
+ _g_desktop_entry_launch (desktop_entry, GTK_WIDGET (button), NULL);
return TRUE;
}
@@ -1955,3 +1909,85 @@
g_free (name);
g_free (icon);
}
+
+
+int
+quick_box_get_child_position (QuickBox *quick_box,
+ GtkWidget *child_to_find)
+{
+ GList *children, *scan;
+ gboolean found = FALSE;
+ int pos;
+
+ children = gtk_container_get_children (GTK_CONTAINER (quick_box));
+ for (pos = 0, scan = children; scan; scan = scan->next) {
+ GtkWidget *child_widget = scan->data;
+
+ if (! QUICK_IS_BUTTON (child_widget))
+ continue;
+
+ if (child_widget == child_to_find) {
+ found = TRUE;
+ break;
+ }
+
+ pos++;
+ }
+ g_list_free (children);
+
+ if (! found)
+ return -1;
+ else
+ return pos;
+}
+
+
+GtkWidget *
+quick_box_get_child_at_pos (QuickBox *quick_box,
+ int pos)
+{
+ GtkWidget *child_widget = NULL;
+ GList *children, *scan;
+ int i;
+
+ children = gtk_container_get_children (GTK_CONTAINER (quick_box));
+ for (i = 0, scan = children; scan; scan = scan->next) {
+ child_widget = scan->data;
+ if (! QUICK_IS_BUTTON (child_widget))
+ continue;
+
+ if (pos == i)
+ break;
+
+ i++;
+ }
+ g_list_free (children);
+
+ return child_widget;
+}
+
+
+GtkWidget *
+quick_box_get_child_from_uri (QuickBox *quick_box,
+ char *uri)
+{
+ GList *children, *scan;
+
+ if (uri == NULL)
+ return NULL;
+
+ children = gtk_container_get_children (GTK_CONTAINER (quick_box));
+ for (scan = children; scan; scan = scan->next) {
+ GtkWidget *child_widget = scan->data;
+ const char *uri2;
+
+ uri2 = g_object_get_data (G_OBJECT (child_widget), "uri");
+ if (uri2 == NULL)
+ continue;
+ if (strcmp (uri, uri2) == 0)
+ return child_widget;
+ }
+ g_list_free (children);
+
+ return NULL;
+}
Modified: trunk/src/quick-box.h
==============================================================================
--- trunk/src/quick-box.h (original)
+++ trunk/src/quick-box.h Wed Feb 4 16:01:19 2009
@@ -54,7 +54,7 @@
};
GType quick_box_get_type (void);
-GtkWidget *quick_box_new (PanelAppletOrient orient,
+GtkWidget * quick_box_new (PanelAppletOrient orient,
int size,
GtkIconTheme *icon_theme);
void quick_box_set_orient (QuickBox *qbox,
@@ -83,14 +83,20 @@
int quick_box_get_pointer_position (QuickBox *qbox,
int x,
int y);
-GtkWidget *quick_box_add_button (QuickBox *qbox,
+GtkWidget * quick_box_add_button (QuickBox *qbox,
const char *uri,
int pos);
-GtkWidget *quick_box_add_separator (QuickBox *qbox,
+GtkWidget * quick_box_add_separator (QuickBox *qbox,
int pos);
void quick_box_update_child (QuickBox *qbox,
QuickButton *child,
GKeyFile *desktop_entry);
void quick_box_icon_theme_changed (QuickBox *qbox);
-
+int quick_box_get_child_position (QuickBox *qbox,
+ GtkWidget *child);
+GtkWidget * quick_box_get_child_at_pos (QuickBox *qbox,
+ int pos);
+GtkWidget * quick_box_get_child_from_uri (QuickBox *qbox,
+ char *uri);
+
#endif /* QUICK_BOX_H */
Modified: trunk/src/quick-desktop-entry-dialog.c
==============================================================================
--- trunk/src/quick-desktop-entry-dialog.c (original)
+++ trunk/src/quick-desktop-entry-dialog.c Wed Feb 4 16:01:19 2009
@@ -393,6 +393,8 @@
gtk_widget_show (self->priv->type_combobox);
gtk_box_pack_start (GTK_BOX (GET_WIDGET ("type_box")), self->priv->type_combobox, TRUE, TRUE, 0);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (GET_WIDGET ("type_label")), self->priv->type_combobox);
+
quick_desktop_entry_dialog_set_entry (self, entry);
g_signal_connect (self->priv->type_combobox,
Modified: trunk/src/quick-lounge.c
==============================================================================
--- trunk/src/quick-lounge.c (original)
+++ trunk/src/quick-lounge.c Wed Feb 4 16:01:19 2009
@@ -21,6 +21,8 @@
*/
#include <config.h>
+#include <sys/types.h>
+#include <unistd.h>
#include <string.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
@@ -340,7 +342,7 @@
desktop_entry = quick_desktop_entry_dialog_get_entry (QUICK_DESKTOP_ENTRY_DIALOG (dialog), &error);
if (error != NULL) {
- _gtk_error_dialog_from_gerror_run (GTK_WINDOW (dialog), &error);
+ _gtk_error_dialog_from_gerror_run (GTK_WINDOW (dialog), _("Could not save the launcher"), &error);
return;
}
@@ -350,14 +352,14 @@
data = g_key_file_to_data (desktop_entry, &length, &error);
if (data == NULL) {
g_key_file_free (desktop_entry);
- _gtk_error_dialog_from_gerror_run (GTK_WINDOW (dialog), &error);
+ _gtk_error_dialog_from_gerror_run (GTK_WINDOW (dialog), _("Could not save the launcher"), &error);
return;
}
uri = g_object_get_data (G_OBJECT (edit_data->button), "uri");
file = g_file_new_for_uri (uri);
if (! g_write_file (file, FALSE, G_FILE_CREATE_NONE, data, length, NULL, &error)) {
- _gtk_error_dialog_from_gerror_run (GTK_WINDOW (dialog), &error);
+ _gtk_error_dialog_from_gerror_run (GTK_WINDOW (dialog), _("Could not save the launcher"), &error);
}
else {
quick_box_update_child (edit_data->quick_lounge->quick_box, (QuickButton*) button, desktop_entry);
@@ -458,37 +460,6 @@
}
-static int
-get_child_position (QuickBox *quick_box,
- GtkWidget *widget)
-{
- GList *children, *scan;
- gboolean found = FALSE;
- int pos;
-
- children = gtk_container_get_children (GTK_CONTAINER (quick_box));
- for (pos = 0, scan = children; scan; scan = scan->next) {
- GtkWidget *child_widget = scan->data;
-
- if (! QUICK_IS_BUTTON (child_widget))
- continue;
-
- if (child_widget == widget) {
- found = TRUE;
- break;
- }
-
- pos++;
- }
- g_list_free (children);
-
- if (! found)
- return -1;
- else
- return pos;
-}
-
-
char *
quick_lounge_util__get_unique_uri (QuickLounge *quick_lounge)
{
@@ -625,7 +596,7 @@
if (quick_lounge == NULL)
return;
- pos = get_child_position (quick_box, button);
+ pos = quick_box_get_child_position (quick_box, button);
quick_lounge_new_launcher (quick_lounge, pos);
}
@@ -642,7 +613,7 @@
if (quick_lounge == NULL)
return;
- pos = get_child_position (quick_box, button);
+ pos = quick_box_get_child_position (quick_box, button);
dlg_add_from_menu (quick_lounge, pos);
}
@@ -658,7 +629,7 @@
if (quick_lounge == NULL)
return;
- pos = get_child_position (quick_box, button);
+ pos = quick_box_get_child_position (quick_box, button);
quick_box_add_separator (quick_box, pos + 1);
quick_lounge_save_order (quick_lounge);
dlg_properties_update (quick_lounge->prop_dialog);
@@ -798,26 +769,23 @@
/* -- Drag & Drop -- */
-static GtkWidget *
-get_button_from_uri (QuickBox *quick_box,
- const char *uri1)
-{
- GList *children, *scan;
-
- children = gtk_container_get_children (GTK_CONTAINER (quick_box));
- for (scan = children; scan; scan = scan->next) {
- GtkWidget *child_widget = scan->data;
- const char *uri2;
-
- uri2 = g_object_get_data (G_OBJECT (child_widget), "uri");
- if (uri2 == NULL)
- continue;
- if (strcmp (uri1, uri2) == 0)
- return child_widget;
- }
- g_list_free (children);
+static void
+open_file_list_with_launcher (QuickLounge *quick_lounge,
+ int pos,
+ GList *list)
+{
+ GtkWidget *button;
+ GKeyFile *desktop_entry;
+
+ button = quick_box_get_child_at_pos (quick_lounge->quick_box, pos);
+ if (button == NULL)
+ return;
- return NULL;
+ desktop_entry = g_object_get_data (G_OBJECT (button), "desktop_entry");
+ if (desktop_entry != NULL)
+ _g_desktop_entry_launch (desktop_entry, button, list);
+
+ path_list_free (list);
}
@@ -844,7 +812,6 @@
gtk_drag_finish (context, TRUE, FALSE, time);
pos = quick_box_get_pointer_position (quick_box, x, y);
-
list = get_file_list_from_url_list ((char *) data->data);
for (scan = list; scan; scan = scan->next) {
@@ -852,19 +819,21 @@
char *uri;
GtkWidget *button;
- if (! is_desktop_file (src_uri))
- continue;
+ if (! is_desktop_file (src_uri)) {
+ open_file_list_with_launcher (quick_lounge, pos, list);
+ return;
+ }
uri = g_build_filename (quick_lounge->location,
file_name_from_path (src_uri),
NULL);
if (strcmp (src_uri, uri) == 0) {
- button = get_button_from_uri (quick_box, uri);
+ button = quick_box_get_child_from_uri (quick_box, uri);
if (button != NULL) {
int button_pos;
- button_pos = get_child_position (quick_box, button);
+ button_pos = quick_box_get_child_position (quick_box, button);
if (button_pos != -1)
quick_box_reorder_child (quick_box, button, pos);
}
@@ -1237,7 +1206,7 @@
&error);
if (error != NULL)
- _gtk_error_dialog_from_gerror_run (NULL, &error);
+ _gtk_error_dialog_from_gerror_run (NULL, NULL, &error);
}
@@ -1415,7 +1384,7 @@
panel_applet_gconf_set_string (applet, PREFS_LOCATION, uri,
&error);
if (error != NULL)
- _gtk_error_dialog_from_gerror_run (NULL, &error);
+ _gtk_error_dialog_from_gerror_run (NULL, NULL, &error);
copy_default_items_to_uri (uri);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]