[quick-lounge-applet] show dialogs on the correct screen
- From: Paolo Bacchilega <paobac src gnome org>
- To: svn-commits-list gnome org
- Subject: [quick-lounge-applet] show dialogs on the correct screen
- Date: Wed, 17 Jun 2009 03:59:01 -0400 (EDT)
commit 929cd9497f89e02b17f6feadbfd385467505c5b7
Author: Paolo Bacchilega <paobac src gnome org>
Date: Wed Jun 17 09:55:45 2009 +0200
show dialogs on the correct screen
[fixed bug]
src/dlg-add-from-menu.c | 208 ++++++++++++------------
src/quick-desktop-entry-dialog.c | 336 +++++++++++++++++++-------------------
src/quick-lounge.c | 299 +++++++++++++++++-----------------
3 files changed, 422 insertions(+), 421 deletions(-)
---
diff --git a/src/dlg-add-from-menu.c b/src/dlg-add-from-menu.c
index 56e8d4e..d7b40eb 100644
--- a/src/dlg-add-from-menu.c
+++ b/src/dlg-add-from-menu.c
@@ -51,7 +51,7 @@ enum {
DIRECTORY_NAME_COLUMN,
DIRECTORY_N_COLUMNS
};
-
+
typedef struct {
QuickLounge *quick_lounge;
@@ -70,7 +70,7 @@ typedef struct {
/* called when the main dialog is closed. */
static void
-destroy_cb (GtkWidget *widget,
+destroy_cb (GtkWidget *widget,
DialogData *data)
{
g_object_unref (data->builder);
@@ -82,7 +82,7 @@ destroy_cb (GtkWidget *widget,
/* called when the "help" button is pressed. */
static void
-help_cb (GtkWidget *widget,
+help_cb (GtkWidget *widget,
DialogData *data)
{
_gtk_show_help (GTK_WINDOW (data->dialog), "quick-lounge", "quick-lounge-usage-add-existing");
@@ -90,18 +90,18 @@ help_cb (GtkWidget *widget,
static gboolean
-add_selected_applications (DialogData *data)
+add_selected_applications (DialogData *data)
{
gboolean changed = FALSE;
GList *keys;
GList *scan;
-
+
keys = g_hash_table_get_keys (data->uris);
for (scan = keys; scan; scan = scan->next) {
const char *path = scan->data;
char *src_uri;
char *dest_uri;
-
+
src_uri = g_filename_to_uri (path, NULL, NULL);
dest_uri = quick_lounge_util__get_unique_uri (data->quick_lounge);
if (! file_copy (src_uri, dest_uri)) {
@@ -112,19 +112,19 @@ add_selected_applications (DialogData *data)
quick_box_add_button (data->quick_box, dest_uri, ++data->pos);
changed = TRUE;
-
+
g_free (dest_uri);
g_free (src_uri);
}
g_list_free (keys);
-
+
return changed;
}
/* called when the "help" button is pressed. */
static void
-ok_cb (GtkWidget *widget,
+ok_cb (GtkWidget *widget,
DialogData *data)
{
if (add_selected_applications (data)) {
@@ -143,7 +143,7 @@ set_application_list (DialogData *data,
GSList *items, *scan;
gtk_list_store_clear (GTK_LIST_STORE (data->application_model));
-
+
if (menu_dir == NULL)
return;
@@ -153,17 +153,17 @@ set_application_list (DialogData *data,
GtkTreeIter iter;
const char *icon = NULL;
GdkPixbuf *image = NULL;
-
+
switch (gmenu_tree_item_get_type (item)) {
case GMENU_TREE_ITEM_ENTRY:
icon = gmenu_tree_entry_get_icon (GMENU_TREE_ENTRY (item));
if (icon != NULL) {
int size;
-
+
size = _gtk_icon_get_pixel_size (GTK_WIDGET (data->dialog), GTK_ICON_SIZE_BUTTON);
image = create_pixbuf (data->quick_lounge->icon_theme, icon, size);
}
-
+
gtk_list_store_append (GTK_LIST_STORE (data->application_model), &iter);
gtk_list_store_set (GTK_LIST_STORE (data->application_model), &iter,
APP_URI_COLUMN, gmenu_tree_entry_get_desktop_file_path (GMENU_TREE_ENTRY (item)),
@@ -172,7 +172,7 @@ set_application_list (DialogData *data,
APP_COMMENT_COLUMN, gmenu_tree_entry_get_comment (GMENU_TREE_ENTRY (item)),
USE_APP_COLUMN, FALSE,
-1);
-
+
if (image != NULL)
g_object_unref (image);
@@ -184,7 +184,7 @@ set_application_list (DialogData *data,
gmenu_tree_item_unref (item);
}
g_slist_free (items);
-}
+}
static void
@@ -199,26 +199,26 @@ add_directories_from_dir (DialogData *data,
GdkPixbuf *image = NULL;
GtkTreeIter iter;
GSList *items, *scan;
-
+
data->tree_items = g_list_prepend (data->tree_items, gmenu_tree_item_ref (menu_dir));
-
+
icon = gmenu_tree_directory_get_icon (menu_dir);
if (icon != NULL) {
int size;
-
+
size = _gtk_icon_get_pixel_size (GTK_WIDGET (data->dialog), GTK_ICON_SIZE_BUTTON);
image = create_pixbuf_or_missing (quick_lounge->icon_theme, icon, size);
}
-
+
gtk_tree_store_append (GTK_TREE_STORE (data->directory_model), &iter, tree_iter);
gtk_tree_store_set (GTK_TREE_STORE (data->directory_model), &iter,
DIRECTORY_MENU_POINTER_COLUMN, menu_dir,
DIRECTORY_MENU_FILE_COLUMN, menu_file,
- DIRECTORY_MENU_ID_COLUMN, gmenu_tree_directory_get_menu_id (menu_dir),
+ DIRECTORY_MENU_ID_COLUMN, gmenu_tree_directory_get_menu_id (menu_dir),
DIRECTORY_ICON_COLUMN, image,
DIRECTORY_NAME_COLUMN, gmenu_tree_directory_get_name (menu_dir),
-1);
-
+
if (image != NULL)
g_object_unref (image);
@@ -233,15 +233,15 @@ add_directories_from_dir (DialogData *data,
default:
break;
}
-
+
gmenu_tree_item_ref (item);
}
g_slist_free (items);
-
+
if (expand) {
GtkTreePath *path;
-
- path = gtk_tree_model_get_path (data->directory_model, &iter);
+
+ path = gtk_tree_model_get_path (data->directory_model, &iter);
gtk_tree_view_expand_row (GTK_TREE_VIEW (data->directory_treeview), path, FALSE);
gtk_tree_path_free (path);
}
@@ -268,20 +268,20 @@ add_directories_from_file (DialogData *data,
static int
-directory_name_column_sort_func (GtkTreeModel *model,
- GtkTreeIter *a,
- GtkTreeIter *b,
+directory_name_column_sort_func (GtkTreeModel *model,
+ GtkTreeIter *a,
+ GtkTreeIter *b,
gpointer user_data)
{
- char *app1;
- char *app2;
+ char *app1;
+ char *app2;
int result;
- gtk_tree_model_get (model, a,
- DIRECTORY_NAME_COLUMN, &app1,
+ gtk_tree_model_get (model, a,
+ DIRECTORY_NAME_COLUMN, &app1,
-1);
- gtk_tree_model_get (model, b,
- DIRECTORY_NAME_COLUMN, &app2,
+ gtk_tree_model_get (model, b,
+ DIRECTORY_NAME_COLUMN, &app2,
-1);
result = g_utf8_collate (app1, app2);
@@ -289,13 +289,13 @@ directory_name_column_sort_func (GtkTreeModel *model,
g_free (app1);
g_free (app2);
- return result;
+ return result;
}
static void
directory_treeview_selection_changed_cb (GtkTreeSelection *selection,
- gpointer user_data)
+ gpointer user_data)
{
DialogData *data = user_data;
GtkTreeIter iter;
@@ -303,11 +303,11 @@ directory_treeview_selection_changed_cb (GtkTreeSelection *selection,
if (! gtk_tree_selection_get_selected (selection, &data->directory_model, &iter))
return;
-
+
gtk_tree_model_get (data->directory_model, &iter,
DIRECTORY_MENU_POINTER_COLUMN, &menu_dir,
-1);
-
+
set_application_list (data, menu_dir);
}
@@ -319,28 +319,28 @@ directory_list_add_columns (DialogData *data,
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
GtkTreeSelection *selection;
-
+
column = gtk_tree_view_column_new ();
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
gtk_tree_view_column_set_sort_column_id (column, DIRECTORY_NAME_COLUMN);
-
+
renderer = gtk_cell_renderer_pixbuf_new ();
gtk_tree_view_column_pack_start (column, renderer, FALSE);
gtk_tree_view_column_set_attributes (column, renderer,
- "pixbuf", DIRECTORY_ICON_COLUMN,
- NULL);
+ "pixbuf", DIRECTORY_ICON_COLUMN,
+ NULL);
renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (column, renderer, TRUE);
gtk_tree_view_column_set_attributes (column, renderer,
- "text", DIRECTORY_NAME_COLUMN,
- NULL);
-
+ "text", DIRECTORY_NAME_COLUMN,
+ NULL);
+
gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (data->directory_model), directory_name_column_sort_func, NULL, NULL);
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (data->directory_model),
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (data->directory_model),
GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
- GTK_SORT_ASCENDING);
-
+ GTK_SORT_ASCENDING);
+
selection = gtk_tree_view_get_selection (treeview);
g_signal_connect (selection,
"changed",
@@ -358,48 +358,48 @@ use_app_toggled (GtkCellRendererToggle *cell,
GtkTreePath *path;
GtkTreeIter iter;
char *uri;
- gboolean active;
+ gboolean active;
path = gtk_tree_path_new_from_string (path_string);
gtk_tree_model_get_iter (data->application_model, &iter, path);
gtk_tree_path_free (path);
-
+
gtk_tree_model_get (GTK_TREE_MODEL (data->application_model), &iter,
- APP_URI_COLUMN, &uri,
- USE_APP_COLUMN, &active,
+ APP_URI_COLUMN, &uri,
+ USE_APP_COLUMN, &active,
-1);
-
+
active = ! active;
if (active) {
if (! g_hash_table_lookup (data->uris, uri))
g_hash_table_insert (data->uris, g_strdup (uri), GINT_TO_POINTER (1));
}
- else
- g_hash_table_remove (data->uris, uri);
-
- gtk_list_store_set (GTK_LIST_STORE (data->application_model), &iter,
- USE_APP_COLUMN, active,
+ else
+ g_hash_table_remove (data->uris, uri);
+
+ gtk_list_store_set (GTK_LIST_STORE (data->application_model), &iter,
+ USE_APP_COLUMN, active,
-1);
-
+
g_free (uri);
}
static int
-application_name_column_sort_func (GtkTreeModel *model,
- GtkTreeIter *a,
- GtkTreeIter *b,
+application_name_column_sort_func (GtkTreeModel *model,
+ GtkTreeIter *a,
+ GtkTreeIter *b,
gpointer user_data)
{
- char *app1;
- char *app2;
+ char *app1;
+ char *app2;
int result;
- gtk_tree_model_get (model, a,
- APP_NAME_COLUMN, &app1,
+ gtk_tree_model_get (model, a,
+ APP_NAME_COLUMN, &app1,
-1);
- gtk_tree_model_get (model, b,
- APP_NAME_COLUMN, &app2,
+ gtk_tree_model_get (model, b,
+ APP_NAME_COLUMN, &app2,
-1);
result = g_utf8_collate (app1, app2);
@@ -407,7 +407,7 @@ application_name_column_sort_func (GtkTreeModel *model,
g_free (app1);
g_free (app2);
- return result;
+ return result;
}
@@ -423,16 +423,16 @@ application_list_add_columns (DialogData *data,
renderer = gtk_cell_renderer_toggle_new ();
gtk_tree_view_column_pack_start (column, renderer, FALSE);
gtk_tree_view_column_set_attributes (column, renderer,
- "active", USE_APP_COLUMN,
- NULL);
- /*g_object_set (G_OBJECT (renderer), "xalign", 0.5, NULL);*/
- gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
-
- g_signal_connect (G_OBJECT (renderer),
- "toggled",
+ "active", USE_APP_COLUMN,
+ NULL);
+ /*g_object_set (G_OBJECT (renderer), "xalign", 0.5, NULL);*/
+ gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
+
+ g_signal_connect (G_OBJECT (renderer),
+ "toggled",
G_CALLBACK (use_app_toggled),
data);
-
+
/**/
column = gtk_tree_view_column_new ();
@@ -441,19 +441,19 @@ application_list_add_columns (DialogData *data,
renderer = gtk_cell_renderer_pixbuf_new ();
gtk_tree_view_column_pack_start (column, renderer, FALSE);
gtk_tree_view_column_set_attributes (column, renderer,
- "pixbuf", APP_ICON_COLUMN,
- NULL);
+ "pixbuf", APP_ICON_COLUMN,
+ NULL);
renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (column, renderer, TRUE);
gtk_tree_view_column_set_attributes (column, renderer,
- "text", APP_NAME_COLUMN,
- NULL);
+ "text", APP_NAME_COLUMN,
+ NULL);
/*gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);*/
gtk_tree_view_column_set_sort_column_id (column, APP_NAME_COLUMN);
- gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
/*gtk_tree_view_set_expander_column (treeview, column);
gtk_tree_view_column_set_clickable (column, FALSE);*/
@@ -465,15 +465,15 @@ application_list_add_columns (DialogData *data,
renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (column, renderer, TRUE);
gtk_tree_view_column_set_attributes (column, renderer,
- "text", APP_COMMENT_COLUMN,
- NULL);
+ "text", APP_COMMENT_COLUMN,
+ NULL);
gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
- gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);*/
-
-
+ gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);*/
+
+
gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (data->application_model), application_name_column_sort_func, NULL, NULL);
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (data->application_model),
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (data->application_model),
GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
GTK_SORT_ASCENDING);
}
@@ -489,14 +489,14 @@ dlg_add_from_menu (QuickLounge *quick_lounge,
GtkWidget *btn_help;
GtkTreeSelection *selection;
GtkTreePath *path;
-
+
data = g_new0 (DialogData, 1);
data->quick_lounge = quick_lounge;
data->quick_box = QUICK_BOX (quick_lounge->quick_box);
data->pos = pos;
data->uris = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, NULL);
-
+
data->builder = _gtk_builder_new_from_file ("add-from-menu.ui");
/* Get the widgets. */
@@ -504,14 +504,14 @@ dlg_add_from_menu (QuickLounge *quick_lounge,
data->dialog = GET_WIDGET("from_menu_dialog");
data->directory_treeview = GET_WIDGET("directory_treeview");
data->application_treeview = GET_WIDGET("application_treeview");
-
+
btn_cancel = GET_WIDGET("cancel_button");
btn_ok = GET_WIDGET("ok_button");
btn_help = GET_WIDGET("help_button");
/* Set widgets data. */
- data->directory_model = GTK_TREE_MODEL (gtk_tree_store_new (DIRECTORY_N_COLUMNS,
+ data->directory_model = GTK_TREE_MODEL (gtk_tree_store_new (DIRECTORY_N_COLUMNS,
G_TYPE_POINTER,
G_TYPE_STRING,
G_TYPE_STRING,
@@ -521,10 +521,10 @@ dlg_add_from_menu (QuickLounge *quick_lounge,
g_object_unref (data->directory_model);
directory_list_add_columns (data, GTK_TREE_VIEW (data->directory_treeview));
- data->application_model = GTK_TREE_MODEL (gtk_list_store_new (APP_N_COLUMNS,
+ data->application_model = GTK_TREE_MODEL (gtk_list_store_new (APP_N_COLUMNS,
G_TYPE_STRING,
GDK_TYPE_PIXBUF,
- G_TYPE_STRING,
+ G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_BOOLEAN));
gtk_tree_view_set_model (GTK_TREE_VIEW (data->application_treeview), data->application_model);
@@ -532,20 +532,20 @@ dlg_add_from_menu (QuickLounge *quick_lounge,
application_list_add_columns (data, GTK_TREE_VIEW (data->application_treeview));
/* Set the signals handlers. */
-
- g_signal_connect (G_OBJECT (data->dialog),
+
+ g_signal_connect (G_OBJECT (data->dialog),
"destroy",
G_CALLBACK (destroy_cb),
data);
- g_signal_connect_swapped (G_OBJECT (btn_cancel),
+ g_signal_connect_swapped (G_OBJECT (btn_cancel),
"clicked",
G_CALLBACK (gtk_widget_destroy),
data->dialog);
- g_signal_connect (G_OBJECT (btn_help),
+ g_signal_connect (G_OBJECT (btn_help),
"clicked",
G_CALLBACK (help_cb),
data);
- g_signal_connect (G_OBJECT (btn_ok),
+ g_signal_connect (G_OBJECT (btn_ok),
"clicked",
G_CALLBACK (ok_cb),
data);
@@ -554,14 +554,12 @@ dlg_add_from_menu (QuickLounge *quick_lounge,
g_object_set_data (G_OBJECT (data->dialog), "dialog_data", data);
- gtk_window_set_screen (GTK_WINDOW (data->dialog),
- gtk_widget_get_screen (GTK_WIDGET (quick_lounge->applet)));
-
+ gtk_window_set_screen (GTK_WINDOW (data->dialog), gtk_widget_get_screen (GTK_WIDGET (quick_lounge->applet)));
gtk_widget_show (data->dialog);
- add_directories_from_file (data, "applications.menu");
- add_directories_from_file (data, "settings.menu");
-
+ add_directories_from_file (data, "applications.menu");
+ add_directories_from_file (data, "settings.menu");
+
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (data->directory_treeview));
path = gtk_tree_path_new ();
gtk_tree_path_append_index (path, 0);
diff --git a/src/quick-desktop-entry-dialog.c b/src/quick-desktop-entry-dialog.c
index 06b3178..566ef9b 100644
--- a/src/quick-desktop-entry-dialog.c
+++ b/src/quick-desktop-entry-dialog.c
@@ -31,8 +31,8 @@
enum {
- CHANGED,
- LAST_SIGNAL
+ CHANGED,
+ LAST_SIGNAL
};
static gpointer parent_class = NULL;
@@ -71,13 +71,13 @@ quick_desktop_entry_dialog_class_init (QuickDesktopEntryDialogClass *class)
GObjectClass *object_class;
parent_class = g_type_class_peek_parent (class);
-
+
object_class = (GObjectClass*) class;
object_class->finalize = quick_desktop_entry_dialog_finalize;
-
+
/* signals */
- signals[CHANGED] = g_signal_new ("changed",
+ signals[CHANGED] = g_signal_new ("changed",
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (QuickDesktopEntryDialogClass, changed),
@@ -99,10 +99,10 @@ quick_desktop_entry_dialog_init (QuickDesktopEntryDialog *dialog)
GType
quick_desktop_entry_dialog_get_type (void)
{
- static GType type = 0;
+ static GType type = 0;
- if (! type) {
- GTypeInfo type_info = {
+ if (! type) {
+ GTypeInfo type_info = {
sizeof (QuickDesktopEntryDialogClass),
NULL,
NULL,
@@ -120,7 +120,7 @@ quick_desktop_entry_dialog_get_type (void)
0);
}
- return type;
+ return type;
}
@@ -133,11 +133,11 @@ quick_desktop_entry_dialog_changed (QuickDesktopEntryDialog *self)
static void
type_combobox_changed_cb (GtkEditable *editable,
- QuickDesktopEntryDialog *self)
+ QuickDesktopEntryDialog *self)
{
- g_key_file_set_boolean (self->priv->current,
- G_KEY_FILE_DESKTOP_GROUP,
- G_KEY_FILE_DESKTOP_KEY_TERMINAL,
+ g_key_file_set_boolean (self->priv->current,
+ G_KEY_FILE_DESKTOP_GROUP,
+ G_KEY_FILE_DESKTOP_KEY_TERMINAL,
gtk_combo_box_get_active (GTK_COMBO_BOX (self->priv->type_combobox)) == 1);
quick_desktop_entry_dialog_changed (self);
}
@@ -145,16 +145,16 @@ type_combobox_changed_cb (GtkEditable *editable,
static void
name_entry_changed_cb (GtkEditable *editable,
- QuickDesktopEntryDialog *self)
+ QuickDesktopEntryDialog *self)
{
char **languages;
-
+
languages = (char **) g_get_language_names ();
- g_key_file_set_locale_string (self->priv->current,
- G_KEY_FILE_DESKTOP_GROUP,
- G_KEY_FILE_DESKTOP_KEY_NAME,
- languages[0],
+ g_key_file_set_locale_string (self->priv->current,
+ G_KEY_FILE_DESKTOP_GROUP,
+ G_KEY_FILE_DESKTOP_KEY_NAME,
+ languages[0],
gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("name_entry"))));
quick_desktop_entry_dialog_changed (self);
}
@@ -162,11 +162,11 @@ name_entry_changed_cb (GtkEditable *editable,
static void
exec_entry_changed_cb (GtkEditable *editable,
- QuickDesktopEntryDialog *self)
+ QuickDesktopEntryDialog *self)
{
- g_key_file_set_string (self->priv->current,
- G_KEY_FILE_DESKTOP_GROUP,
- G_KEY_FILE_DESKTOP_KEY_EXEC,
+ g_key_file_set_string (self->priv->current,
+ G_KEY_FILE_DESKTOP_GROUP,
+ G_KEY_FILE_DESKTOP_KEY_EXEC,
gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("exec_entry"))));
quick_desktop_entry_dialog_changed (self);
}
@@ -174,11 +174,11 @@ exec_entry_changed_cb (GtkEditable *editable,
static void
url_entry_changed_cb (GtkEditable *editable,
- QuickDesktopEntryDialog *self)
+ QuickDesktopEntryDialog *self)
{
- g_key_file_set_string (self->priv->current,
- G_KEY_FILE_DESKTOP_GROUP,
- G_KEY_FILE_DESKTOP_KEY_URL,
+ g_key_file_set_string (self->priv->current,
+ G_KEY_FILE_DESKTOP_GROUP,
+ G_KEY_FILE_DESKTOP_KEY_URL,
gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("url_entry"))));
quick_desktop_entry_dialog_changed (self);
}
@@ -186,16 +186,16 @@ url_entry_changed_cb (GtkEditable *editable,
static void
comment_entry_changed_cb (GtkEditable *editable,
- QuickDesktopEntryDialog *self)
+ QuickDesktopEntryDialog *self)
{
char **languages;
-
+
languages = (char **) g_get_language_names ();
-
- g_key_file_set_locale_string (self->priv->current,
- G_KEY_FILE_DESKTOP_GROUP,
- G_KEY_FILE_DESKTOP_KEY_COMMENT,
- languages[0],
+
+ g_key_file_set_locale_string (self->priv->current,
+ G_KEY_FILE_DESKTOP_GROUP,
+ G_KEY_FILE_DESKTOP_KEY_COMMENT,
+ languages[0],
gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("comment_entry"))));
quick_desktop_entry_dialog_changed (self);
}
@@ -203,12 +203,12 @@ comment_entry_changed_cb (GtkEditable *editable,
static void
quick_desktop_entry_dialog_update_icon (QuickDesktopEntryDialog *self,
- GKeyFile *entry)
+ GKeyFile *entry)
{
char *icon;
int size;
GdkPixbuf *pixbuf;
-
+
icon = g_key_file_get_string (entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_ICON, NULL);
size = _gtk_icon_get_pixel_size (GTK_WIDGET (self), GTK_ICON_SIZE_DIALOG);
pixbuf = create_pixbuf_or_missing (gtk_icon_theme_get_default (), icon, size);
@@ -221,36 +221,36 @@ quick_desktop_entry_dialog_update_icon (QuickDesktopEntryDialog *self,
static void
icon_chooser_response_cb (GtkWidget *widget,
- int response,
- QuickDesktopEntryDialog *self)
+ int response,
+ QuickDesktopEntryDialog *self)
{
- GtkFileChooser *file_chooser = GTK_FILE_CHOOSER (widget);
- char *path;
-
- if ((response == GTK_RESPONSE_CANCEL) || (response == GTK_RESPONSE_DELETE_EVENT)) {
- gtk_widget_destroy (widget);
- return;
- }
-
- path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_chooser));
- if (path == NULL)
- return;
-
- g_key_file_set_string (self->priv->current, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_ICON, path);
- quick_desktop_entry_dialog_update_icon (self, self->priv->current);
-
+ GtkFileChooser *file_chooser = GTK_FILE_CHOOSER (widget);
+ char *path;
+
+ if ((response == GTK_RESPONSE_CANCEL) || (response == GTK_RESPONSE_DELETE_EVENT)) {
+ gtk_widget_destroy (widget);
+ return;
+ }
+
+ path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_chooser));
+ if (path == NULL)
+ return;
+
+ g_key_file_set_string (self->priv->current, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_ICON, path);
+ quick_desktop_entry_dialog_update_icon (self, self->priv->current);
+
quick_desktop_entry_dialog_changed (self);
-
- g_free (path);
-
- if (response == GTK_RESPONSE_OK)
- gtk_widget_destroy (GTK_WIDGET (file_chooser));
+
+ g_free (path);
+
+ if (response == GTK_RESPONSE_OK)
+ gtk_widget_destroy (GTK_WIDGET (file_chooser));
}
static void
icon_button_clicked_cb (GtkButton *button,
- QuickDesktopEntryDialog *self)
+ QuickDesktopEntryDialog *self)
{
GtkWidget *icon_chooser;
char *icon;
@@ -258,7 +258,7 @@ icon_button_clicked_cb (GtkButton *button,
GFile *file;
char *uri;
gboolean set_current = FALSE;
-
+
icon_chooser = gtk_file_chooser_dialog_new (_("Select an Image"),
GTK_WINDOW (self),
GTK_FILE_CHOOSER_ACTION_OPEN,
@@ -266,80 +266,81 @@ icon_button_clicked_cb (GtkButton *button,
GTK_STOCK_APPLY, GTK_RESPONSE_APPLY,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
-
+
gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (icon_chooser), FALSE);
- gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (icon_chooser),TRUE);
- gtk_dialog_set_default_response (GTK_DIALOG (icon_chooser), GTK_RESPONSE_OK);
-
- icon = g_key_file_get_string (self->priv->current, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_ICON, NULL);
- icon_path = panel_find_icon (gtk_icon_theme_get_default (), icon, _gtk_icon_get_pixel_size (GTK_WIDGET (self), GTK_ICON_SIZE_DIALOG));
- if ((icon_path == NULL) || (icon_path[0] != '/')) {
- g_free (icon_path);
- icon_path = g_strdup ("/usr/share/pixmaps/");
- set_current = TRUE;
- }
- file = g_file_new_for_path (icon_path);
- uri = g_file_get_uri (file);
+ gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (icon_chooser),TRUE);
+ gtk_dialog_set_default_response (GTK_DIALOG (icon_chooser), GTK_RESPONSE_OK);
+
+ icon = g_key_file_get_string (self->priv->current, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_ICON, NULL);
+ icon_path = panel_find_icon (gtk_icon_theme_get_default (), icon, _gtk_icon_get_pixel_size (GTK_WIDGET (self), GTK_ICON_SIZE_DIALOG));
+ if ((icon_path == NULL) || (icon_path[0] != '/')) {
+ g_free (icon_path);
+ icon_path = g_strdup ("/usr/share/pixmaps/");
+ set_current = TRUE;
+ }
+ file = g_file_new_for_path (icon_path);
+ uri = g_file_get_uri (file);
if (set_current)
gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (icon_chooser), uri);
else
gtk_file_chooser_set_uri (GTK_FILE_CHOOSER (icon_chooser), uri);
-
+
g_signal_connect (G_OBJECT (icon_chooser),
"response",
G_CALLBACK (icon_chooser_response_cb),
self);
- gtk_window_set_modal (GTK_WINDOW (icon_chooser), TRUE);
- gtk_widget_show (icon_chooser);
-
+ gtk_window_set_screen (GTK_WINDOW (icon_chooser), gtk_widget_get_screen (GTK_WIDGET (button)));
+ gtk_window_set_modal (GTK_WINDOW (icon_chooser), TRUE);
+ gtk_widget_show (icon_chooser);
+
g_free (uri);
- g_object_unref (file);
- g_free (icon_path);
- g_free (icon);
+ g_object_unref (file);
+ g_free (icon_path);
+ g_free (icon);
}
static void
command_chooser_response_cb (GtkWidget *widget,
- int response,
- QuickDesktopEntryDialog *self)
+ int response,
+ QuickDesktopEntryDialog *self)
{
- GtkFileChooser *file_chooser = GTK_FILE_CHOOSER (widget);
- gboolean changed = FALSE;
-
- if ((response == GTK_RESPONSE_CANCEL) || (response == GTK_RESPONSE_DELETE_EVENT)) {
- gtk_widget_destroy (widget);
- return;
- }
-
+ GtkFileChooser *file_chooser = GTK_FILE_CHOOSER (widget);
+ gboolean changed = FALSE;
+
+ if ((response == GTK_RESPONSE_CANCEL) || (response == GTK_RESPONSE_DELETE_EVENT)) {
+ gtk_widget_destroy (widget);
+ return;
+ }
+
if (response != GTK_RESPONSE_OK)
return;
-
- if (self->priv->entry_type == DESKTOP_ENTRY_TYPE_APPLICATION) {
- char *command;
-
- command = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_chooser));
+
+ if (self->priv->entry_type == DESKTOP_ENTRY_TYPE_APPLICATION) {
+ char *command;
+
+ command = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_chooser));
if (command != NULL) {
g_key_file_set_string (self->priv->current, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_EXEC, command);
gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("exec_entry")), command);
changed = TRUE;
}
- }
- else if (self->priv->entry_type == DESKTOP_ENTRY_TYPE_LINK) {
- char *uri;
-
- uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (file_chooser));
- if (uri != NULL) {
+ }
+ else if (self->priv->entry_type == DESKTOP_ENTRY_TYPE_LINK) {
+ char *uri;
+
+ uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (file_chooser));
+ if (uri != NULL) {
g_key_file_set_string (self->priv->current, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_URL, uri);
gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("url_entry")), uri);
changed = TRUE;
- }
- }
-
- if (! changed)
- return;
-
+ }
+ }
+
+ if (! changed)
+ return;
+
quick_desktop_entry_dialog_changed (self);
gtk_widget_destroy (GTK_WIDGET (file_chooser));
}
@@ -347,54 +348,55 @@ command_chooser_response_cb (GtkWidget *widget,
static void
browse_button_clicked_cb (GtkButton *button,
- QuickDesktopEntryDialog *self)
+ QuickDesktopEntryDialog *self)
{
GtkWidget *command_chooser;
char *path;
GFile *file;
char *uri;
gboolean set_current = FALSE;
-
+
command_chooser = gtk_file_chooser_dialog_new ((self->priv->entry_type == DESKTOP_ENTRY_TYPE_APPLICATION) ? _("Select a Command") : _("Select a File"),
GTK_WINDOW (self),
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
-
+
gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (command_chooser), FALSE);
- gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (command_chooser),TRUE);
- gtk_dialog_set_default_response (GTK_DIALOG (command_chooser), GTK_RESPONSE_OK);
-
- if (self->priv->entry_type == DESKTOP_ENTRY_TYPE_APPLICATION)
- path = g_key_file_get_string (self->priv->current, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_EXEC, NULL);
- else if (self->priv->entry_type == DESKTOP_ENTRY_TYPE_LINK)
- path = g_key_file_get_string (self->priv->current, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_URL, NULL);
- else
- path = NULL;
-
- if ((path == NULL) || (path[0] != '/')) {
- g_free (path);
- path = g_strdup (g_get_home_dir ());
- set_current = TRUE;
- }
+ gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (command_chooser),TRUE);
+ gtk_dialog_set_default_response (GTK_DIALOG (command_chooser), GTK_RESPONSE_OK);
+
+ if (self->priv->entry_type == DESKTOP_ENTRY_TYPE_APPLICATION)
+ path = g_key_file_get_string (self->priv->current, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_EXEC, NULL);
+ else if (self->priv->entry_type == DESKTOP_ENTRY_TYPE_LINK)
+ path = g_key_file_get_string (self->priv->current, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_URL, NULL);
+ else
+ path = NULL;
+
+ if ((path == NULL) || (path[0] != '/')) {
+ g_free (path);
+ path = g_strdup (g_get_home_dir ());
+ set_current = TRUE;
+ }
file = g_file_new_for_path (path);
- uri = g_file_get_uri (file);
+ uri = g_file_get_uri (file);
if (set_current)
gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (command_chooser), uri);
else
gtk_file_chooser_set_uri (GTK_FILE_CHOOSER (command_chooser), uri);
-
+
g_signal_connect (G_OBJECT (command_chooser),
"response",
G_CALLBACK (command_chooser_response_cb),
self);
- gtk_window_set_modal (GTK_WINDOW (command_chooser), TRUE);
- gtk_widget_show (command_chooser);
-
+ gtk_window_set_screen (GTK_WINDOW (command_chooser), gtk_widget_get_screen (GTK_WIDGET (button)));
+ gtk_window_set_modal (GTK_WINDOW (command_chooser), TRUE);
+ gtk_widget_show (command_chooser);
+
g_free (uri);
- g_object_unref (file);
+ g_object_unref (file);
g_free (path);
}
@@ -414,14 +416,14 @@ quick_desktop_entry_dialog_construct (QuickDesktopEntryDialog *self,
gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (self)->vbox), 5);
gtk_container_set_border_width (GTK_CONTAINER (self), 5);
- quick_desktop_entry_dialog_set_entry (self, entry);
+ quick_desktop_entry_dialog_set_entry (self, entry);
}
GtkWidget *
quick_desktop_entry_dialog_new (const char *title,
- GtkWindow *parent,
- GKeyFile *entry)
+ GtkWindow *parent,
+ GKeyFile *entry)
{
QuickDesktopEntryDialog *self;
@@ -436,41 +438,41 @@ static void
quick_desktop_entry_dialog_update (QuickDesktopEntryDialog *self,
GKeyFile *entry)
{
-
-
- char *name;
+
+
+ char *name;
char *comment;
-
+
if (self->priv->entry_type == DESKTOP_ENTRY_TYPE_APPLICATION) {
gboolean terminal;
char *exec;
-
+
terminal = g_key_file_get_boolean (entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_TERMINAL, NULL);
gtk_combo_box_set_active (GTK_COMBO_BOX (self->priv->type_combobox), terminal ? 1 : 0);
-
+
exec = g_key_file_get_string (entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_EXEC, NULL);
- gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("exec_entry")), exec ? exec : "");
-
+ gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("exec_entry")), exec ? exec : "");
+
g_free (exec);
- }
+ }
else if (self->priv->entry_type == DESKTOP_ENTRY_TYPE_LINK) {
char *url;
-
+
url = g_key_file_get_string (entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_URL, NULL);
- gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("url_entry")), url ? url : "");
-
+ gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("url_entry")), url ? url : "");
+
g_free (url);
}
-
+
name = g_key_file_get_locale_string (entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NAME, NULL, NULL);
gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("name_entry")), name ? name : "");
-
+
comment = g_key_file_get_locale_string (entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_COMMENT, NULL, NULL);
gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("comment_entry")), comment ? comment : "");
-
+
g_free (comment);
g_free (name);
-
+
quick_desktop_entry_dialog_update_icon (self, entry);
}
@@ -481,36 +483,36 @@ quick_desktop_entry_dialog_set_entry (QuickDesktopEntryDialog *self,
{
char *type;
GtkWidget *content;
-
- if (self->priv->original != NULL)
+
+ if (self->priv->original != NULL)
g_key_file_free (self->priv->original);
self->priv->original = _g_key_file_dup (entry);
-
- if (self->priv->current != NULL)
+
+ if (self->priv->current != NULL)
g_key_file_free (self->priv->current);
self->priv->current = _g_key_file_dup (entry);
/**/
- type = g_key_file_get_string (entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_TYPE, NULL);
+ type = g_key_file_get_string (self->priv->current, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_TYPE, NULL);
if (g_strcmp0 (type, G_KEY_FILE_DESKTOP_TYPE_APPLICATION) == 0)
self->priv->entry_type = DESKTOP_ENTRY_TYPE_APPLICATION;
else if (g_strcmp0 (type, G_KEY_FILE_DESKTOP_TYPE_LINK) == 0)
self->priv->entry_type = DESKTOP_ENTRY_TYPE_LINK;
else
self->priv->entry_type = DESKTOP_ENTRY_TYPE_UNKNOWN;
-
+
if (self->priv->builder != NULL) {
g_object_unref (self->priv->builder);
self->priv->builder = NULL;
}
-
+
if (self->priv->entry_type == DESKTOP_ENTRY_TYPE_UNKNOWN)
return;
-
+
if (self->priv->entry_type == DESKTOP_ENTRY_TYPE_APPLICATION) {
self->priv->builder = _gtk_builder_new_from_file ("desktop-entry-editor.ui");
-
+
self->priv->type_combobox = _gtk_combo_box_new_with_texts (_("Application"), _("Application in Terminal"), NULL);
gtk_widget_show (self->priv->type_combobox);
gtk_box_pack_start (GTK_BOX (GET_WIDGET ("type_box")), self->priv->type_combobox, TRUE, TRUE, 0);
@@ -518,14 +520,14 @@ quick_desktop_entry_dialog_set_entry (QuickDesktopEntryDialog *self,
}
else if (self->priv->entry_type == DESKTOP_ENTRY_TYPE_LINK)
self->priv->builder = _gtk_builder_new_from_file ("link-entry-editor.ui");
-
+
content = _gtk_builder_get_widget (self->priv->builder, "desktop_entry_editor");
gtk_container_set_border_width (GTK_CONTAINER (content), 5);
gtk_widget_show (content);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (self)->vbox), content, TRUE, TRUE, 0);
-
+
quick_desktop_entry_dialog_update (self, self->priv->current);
-
+
if (self->priv->entry_type == DESKTOP_ENTRY_TYPE_APPLICATION) {
g_signal_connect (self->priv->type_combobox,
"changed",
@@ -548,9 +550,9 @@ quick_desktop_entry_dialog_set_entry (QuickDesktopEntryDialog *self,
g_signal_connect (GET_WIDGET ("url_browse_button"),
"clicked",
G_CALLBACK (browse_button_clicked_cb),
- self);
+ self);
}
-
+
g_signal_connect (GET_WIDGET ("name_entry"),
"changed",
G_CALLBACK (name_entry_changed_cb),
@@ -563,7 +565,7 @@ quick_desktop_entry_dialog_set_entry (QuickDesktopEntryDialog *self,
"clicked",
G_CALLBACK (icon_button_clicked_cb),
self);
-
+
g_free (type);
}
@@ -579,10 +581,10 @@ quick_desktop_entry_dialog_get_entry (QuickDesktopEntryDialog *self,
void
quick_desktop_entry_dialog_revert (QuickDesktopEntryDialog *self)
{
- if (self->priv->current != NULL)
+ if (self->priv->current != NULL)
g_key_file_free (self->priv->current);
self->priv->current = _g_key_file_dup (self->priv->original);
-
+
quick_desktop_entry_dialog_update (self, self->priv->current);
quick_desktop_entry_dialog_changed (self);
}
diff --git a/src/quick-lounge.c b/src/quick-lounge.c
index 77504d7..dd6711d 100644
--- a/src/quick-lounge.c
+++ b/src/quick-lounge.c
@@ -59,8 +59,8 @@
enum {
- REVERT_BUTTON,
- QUICK_RESPONSE_REVERT
+ REVERT_BUTTON,
+ QUICK_RESPONSE_REVERT
};
@@ -91,11 +91,11 @@ properties_verb_cb (BonoboUIComponent *uic,
}
if (quick_lounge->prop_dialog != NULL) {
- gtk_window_set_screen (GTK_WINDOW (quick_lounge->prop_dialog),
- gtk_widget_get_screen (GTK_WIDGET (quick_lounge->applet)));
+ gtk_window_set_screen (GTK_WINDOW (quick_lounge->prop_dialog),
+ gtk_widget_get_screen (GTK_WIDGET (quick_lounge->applet)));
gtk_window_present (GTK_WINDOW (quick_lounge->prop_dialog));
- }
+ }
}
@@ -113,7 +113,7 @@ about_verb_cb (BonoboUIComponent *uic,
QuickLounge *quick_lounge,
const gchar *verbname)
{
- static GtkWidget *about_dialog = NULL;
+ static GtkWidget *about_dialog = NULL;
const char *authors[] = {
"Paolo Bacchilega <paolo bacchilega libero it>",
NULL
@@ -124,31 +124,31 @@ about_verb_cb (BonoboUIComponent *uic,
};
const char *translator_credits = _("translator_credits");
- if (about_dialog) {
- gtk_window_set_screen (GTK_WINDOW (about_dialog),
- gtk_widget_get_screen (GTK_WIDGET (quick_lounge->applet)));
- gtk_window_present (GTK_WINDOW (about_dialog));
- return;
- }
+ if (about_dialog) {
+ gtk_window_set_screen (GTK_WINDOW (about_dialog),
+ gtk_widget_get_screen (GTK_WIDGET (quick_lounge->applet)));
+ gtk_window_present (GTK_WINDOW (about_dialog));
+ return;
+ }
- about_dialog = gtk_about_dialog_new ();
+ about_dialog = gtk_about_dialog_new ();
- g_object_set (about_dialog,
+ g_object_set (about_dialog,
"name", _("Launchers List"),
- "version", VERSION,
+ "version", VERSION,
"copyright", "Copyright \xc2\xa9 2002-2009 Free Software Foundation, Inc.",
- "comments", _("Organize your favorite applications on the Panel"),
- "authors", authors,
- "documenters", documenters,
- "translator-credits", strcmp (translator_credits, "translator_credits") != 0 ? translator_credits : NULL,
- "logo-icon-name", "quick-lounge-applet",
- NULL);
+ "comments", _("Organize your favorite applications on the Panel"),
+ "authors", authors,
+ "documenters", documenters,
+ "translator-credits", strcmp (translator_credits, "translator_credits") != 0 ? translator_credits : NULL,
+ "logo-icon-name", "quick-lounge-applet",
+ NULL);
gtk_window_set_wmclass (GTK_WINDOW (about_dialog), "quick-lounge-applet", "Quick-lounge-applet");
- gtk_window_set_screen (GTK_WINDOW (about_dialog), gtk_widget_get_screen (GTK_WIDGET (quick_lounge->applet)));
+ gtk_window_set_screen (GTK_WINDOW (about_dialog), gtk_widget_get_screen (GTK_WIDGET (quick_lounge->applet)));
g_signal_connect (about_dialog, "destroy", G_CALLBACK (gtk_widget_destroyed), &about_dialog);
g_signal_connect (about_dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
- gtk_widget_show (about_dialog);
+ gtk_widget_show (about_dialog);
}
static const BonoboUIVerb menu_verbs [] = {
@@ -166,7 +166,7 @@ applet_destroy (GtkWidget *applet,
/* free memory */
if (quick_lounge->prop_dialog != NULL)
- gtk_widget_destroy (quick_lounge->prop_dialog);
+ gtk_widget_destroy (quick_lounge->prop_dialog);
g_free (quick_lounge->location);
g_object_unref (quick_lounge->icon_theme);
@@ -176,11 +176,11 @@ applet_destroy (GtkWidget *applet,
static void
applet_change_orient (PanelApplet *applet,
- PanelAppletOrient orientation,
- QuickLounge *quick_lounge)
+ PanelAppletOrient orientation,
+ QuickLounge *quick_lounge)
{
- if (quick_lounge->orientation == orientation)
- return;
+ if (quick_lounge->orientation == orientation)
+ return;
quick_lounge->orientation = orientation;
quick_box_set_orient (quick_lounge->quick_box, orientation);
}
@@ -188,8 +188,8 @@ applet_change_orient (PanelApplet *applet,
static void
applet_change_size (PanelApplet *applet,
- int size,
- QuickLounge *quick_lounge)
+ int size,
+ QuickLounge *quick_lounge)
{
if (quick_lounge->size != size) {
quick_lounge->size = size;
@@ -200,10 +200,10 @@ applet_change_size (PanelApplet *applet,
static void
applet_change_background (PanelApplet *applet,
- PanelAppletBackgroundType type,
- GdkColor *color,
- GdkPixmap *pixmap,
- QuickLounge *quick_lounge)
+ PanelAppletBackgroundType type,
+ GdkColor *color,
+ GdkPixmap *pixmap,
+ QuickLounge *quick_lounge)
{
/* taken from the Trash Applet */
GtkRcStyle *rc_style;
@@ -240,18 +240,18 @@ applet_change_background (PanelApplet *applet,
static void
applet_size_request (GtkWidget *widget,
- GtkRequisition *requisition,
- QuickLounge *quick_lounge)
+ GtkRequisition *requisition,
+ QuickLounge *quick_lounge)
{
GtkRequisition child_req;
- const int *size_hints;
+ const int *size_hints;
int len;
gtk_widget_get_child_requisition (quick_lounge->applet, &child_req);
size_hints = quick_box_get_size_hint_list (quick_lounge->quick_box, &len);
panel_applet_set_size_hints (PANEL_APPLET (quick_lounge->applet),
- size_hints,
- len,
+ size_hints,
+ len,
child_req.width);
}
@@ -296,7 +296,7 @@ static void
edit_desktop_entry_dialog_destroy_cb (GtkWidget *widget,
gpointer user_data)
{
- g_free (user_data);
+ g_free (user_data);
}
@@ -307,17 +307,17 @@ edit_desktop_entry_dialog_response_cb (GtkDialog *dialog,
{
switch (response) {
case GTK_RESPONSE_HELP:
- _gtk_show_help (NULL, "user-guide", "gospanel-52");
- break;
-
- case QUICK_RESPONSE_REVERT:
+ _gtk_show_help (NULL, "user-guide", "gospanel-52");
+ break;
+
+ case QUICK_RESPONSE_REVERT:
quick_desktop_entry_dialog_revert (QUICK_DESKTOP_ENTRY_DIALOG (dialog));
break;
-
+
case GTK_RESPONSE_CLOSE:
gtk_widget_destroy (GTK_WIDGET (dialog));
break;
-
+
default:
break;
}
@@ -337,35 +337,35 @@ edit_desktop_entry_dialog_changed_cb (GtkDialog *dialog,
gsize length;
const char *uri;
GFile *file;
-
+
gtk_dialog_set_response_sensitive (dialog, QUICK_RESPONSE_REVERT, ! reverted);
-
+
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), _("Could not save the launcher"), &error);
return;
}
-
+
if (desktop_entry == NULL)
return;
-
+
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), _("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)) {
+ if (! g_write_file (file, FALSE, G_FILE_CREATE_NONE, data, length, NULL, &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);
dlg_properties_update (edit_data->quick_lounge->prop_dialog);
}
-
+
g_object_unref (file);
g_free (data);
g_key_file_free (desktop_entry);
@@ -379,13 +379,13 @@ quick_lounge_util__item_properties (QuickLounge *quick_lounge,
EditItemData *data;
GtkWidget *dialog;
GKeyFile *desktop_entry;
-
+
data = g_new0 (EditItemData, 1);
- data->quick_lounge = quick_lounge;
+ data->quick_lounge = quick_lounge;
data->button = button;
-
+
desktop_entry = g_object_get_data (G_OBJECT (button), "desktop_entry");
-
+
dialog = quick_desktop_entry_dialog_new (_("Launcher Properties"), NULL, desktop_entry);
gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_HELP, GTK_RESPONSE_HELP);
gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_REVERT_TO_SAVED, QUICK_RESPONSE_REVERT);
@@ -394,20 +394,21 @@ quick_lounge_util__item_properties (QuickLounge *quick_lounge,
gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), QUICK_RESPONSE_REVERT, FALSE);
g_signal_connect (dialog,
- "destroy",
- G_CALLBACK (edit_desktop_entry_dialog_destroy_cb),
- data);
- g_signal_connect (dialog,
- "response",
- G_CALLBACK (edit_desktop_entry_dialog_response_cb),
- data);
- g_signal_connect (dialog,
+ "destroy",
+ G_CALLBACK (edit_desktop_entry_dialog_destroy_cb),
+ data);
+ g_signal_connect (dialog,
+ "response",
+ G_CALLBACK (edit_desktop_entry_dialog_response_cb),
+ data);
+ g_signal_connect (dialog,
"changed",
- G_CALLBACK (edit_desktop_entry_dialog_changed_cb),
- data);
+ G_CALLBACK (edit_desktop_entry_dialog_changed_cb),
+ data);
- gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
- gtk_window_present (GTK_WINDOW (dialog));
+ gtk_window_set_screen (GTK_WINDOW (dialog), gtk_widget_get_screen (GTK_WIDGET (quick_lounge->applet)));
+ gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+ gtk_window_present (GTK_WINDOW (dialog));
}
@@ -489,10 +490,10 @@ quick_lounge_add_launcher (QuickLounge *quick_lounge,
gsize length;
char *uri;
GFile *file;
-
+
if (desktop_entry == NULL)
return FALSE;
-
+
data = g_key_file_to_data (desktop_entry, &length, &error);
if (data == NULL) {
g_key_file_free (desktop_entry);
@@ -502,11 +503,11 @@ quick_lounge_add_launcher (QuickLounge *quick_lounge,
error->message);
g_clear_error (&error);
return FALSE;
- }
-
+ }
+
uri = quick_lounge_util__get_unique_uri (quick_lounge);
file = g_file_new_for_uri (uri);
- if (! g_write_file (file, FALSE, G_FILE_CREATE_NONE, data, length, NULL, &error)) {
+ if (! g_write_file (file, FALSE, G_FILE_CREATE_NONE, data, length, NULL, &error)) {
_gtk_error_dialog_run (NULL,
ERROR_FORMAT,
_("Could not create the new launcher"),
@@ -517,11 +518,11 @@ quick_lounge_add_launcher (QuickLounge *quick_lounge,
quick_box_add_button (quick_lounge->quick_box, uri, position);
launcher_added = TRUE;
}
-
+
g_object_unref (file);
g_free (uri);
g_free (data);
-
+
return launcher_added;
}
@@ -534,23 +535,23 @@ new_desktop_entry_dialog_response_cb (GtkDialog *dialog,
EditItemData *edit_data = user_data;
GKeyFile *desktop_entry;
GError *error = NULL;
-
+
switch (response) {
case GTK_RESPONSE_HELP:
- _gtk_show_help (NULL, "user-guide", "gospanel-52");
- break;
-
+ _gtk_show_help (NULL, "user-guide", "gospanel-52");
+ break;
+
case GTK_RESPONSE_CANCEL:
gtk_widget_destroy (GTK_WIDGET (dialog));
break;
-
+
default:
break;
}
-
+
if (response != GTK_RESPONSE_OK)
return;
-
+
desktop_entry = quick_desktop_entry_dialog_get_entry (QUICK_DESKTOP_ENTRY_DIALOG (dialog), &error);
if (error != NULL) {
_gtk_error_dialog_run (NULL,
@@ -560,13 +561,13 @@ new_desktop_entry_dialog_response_cb (GtkDialog *dialog,
g_clear_error (&error);
return;
}
-
+
if (quick_lounge_add_launcher (edit_data->quick_lounge, desktop_entry, edit_data->position + 1)) {
quick_lounge_save_order (edit_data->quick_lounge);
dlg_properties_update (edit_data->quick_lounge->prop_dialog);
gtk_widget_destroy (GTK_WIDGET (dialog));
}
-
+
g_key_file_free (desktop_entry);
}
@@ -577,27 +578,28 @@ quick_lounge_new_launcher (QuickLounge *quick_lounge,
{
EditItemData *data;
GtkWidget *dialog;
-
+
data = g_new0 (EditItemData, 1);
- data->quick_lounge = quick_lounge;
+ data->quick_lounge = quick_lounge;
data->position = position;
-
+
dialog = quick_desktop_entry_dialog_new (_("New Launcher"), NULL, NULL);
gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_HELP, GTK_RESPONSE_HELP);
gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_OK, GTK_RESPONSE_OK);
g_signal_connect (dialog,
- "destroy",
- G_CALLBACK (edit_desktop_entry_dialog_destroy_cb),
- data);
- g_signal_connect (dialog,
- "response",
- G_CALLBACK (new_desktop_entry_dialog_response_cb),
- data);
-
- gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
- gtk_window_present (GTK_WINDOW (dialog));
+ "destroy",
+ G_CALLBACK (edit_desktop_entry_dialog_destroy_cb),
+ data);
+ g_signal_connect (dialog,
+ "response",
+ G_CALLBACK (new_desktop_entry_dialog_response_cb),
+ data);
+
+ gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+ gtk_window_set_screen (GTK_WINDOW (dialog), gtk_widget_get_screen (GTK_WIDGET (quick_lounge->applet)));
+ gtk_window_present (GTK_WINDOW (dialog));
}
@@ -727,7 +729,7 @@ populate_context_menu (GtkWidget *popup_menu,
"activate",
G_CALLBACK (add_from_menu_cb),
button);
-
+
/**/
item = gtk_image_menu_item_new_with_mnemonic (_("_New Launcher"));
@@ -778,7 +780,6 @@ populate_context_menu (GtkWidget *popup_menu,
"activate",
G_CALLBACK (item_move_cb),
button);
-
}
@@ -786,8 +787,8 @@ populate_context_menu (GtkWidget *popup_menu,
static void
-open_file_list_with_launcher (QuickLounge *quick_lounge,
- int pos,
+open_file_list_with_launcher (QuickLounge *quick_lounge,
+ int pos,
GList *list)
{
GtkWidget *button;
@@ -795,7 +796,7 @@ open_file_list_with_launcher (QuickLounge *quick_lounge,
button = quick_box_get_child_at_pos (quick_lounge->quick_box, pos);
if (button == NULL)
- return;
+ return;
desktop_entry = g_object_get_data (G_OBJECT (button), "desktop_entry");
if (desktop_entry != NULL)
@@ -815,15 +816,15 @@ drag_data_received (GtkWidget *widget,
{
QuickLounge *quick_lounge = extra_data;
QuickBox *quick_box = QUICK_BOX (widget);
- GList *list, *scan;
+ GList *list, *scan;
int pos;
QuickDropPos drop_position;
gboolean launcher_list_changed = FALSE;
-
- if (! ((data->length >= 0) && (data->format == 8))) {
- gtk_drag_finish (context, FALSE, FALSE, time);
- return;
- }
+
+ if (! ((data->length >= 0) && (data->format == 8))) {
+ gtk_drag_finish (context, FALSE, FALSE, time);
+ return;
+ }
gtk_drag_finish (context, TRUE, FALSE, time);
@@ -833,7 +834,7 @@ drag_data_received (GtkWidget *widget,
if ((drop_position == QUICK_DROP_POSITION_INTO_OR_BEFORE)
|| (drop_position == QUICK_DROP_POSITION_INTO_OR_AFTER))
{
- if (! is_desktop_file (list->data)) {
+ if (! is_desktop_file (list->data)) {
open_file_list_with_launcher (quick_lounge, pos, list);
path_list_free (list);
return;
@@ -845,21 +846,21 @@ drag_data_received (GtkWidget *widget,
{
pos++;
}
-
+
for (scan = list; scan; scan = scan->next) {
char *src_uri = scan->data;
-
- if (is_desktop_file (src_uri)) {
+
+ if (is_desktop_file (src_uri)) {
char *uri;
GtkWidget *button;
uri = g_build_filename (quick_lounge->location,
file_name_from_path (src_uri),
NULL);
-
+
if (strcmp (src_uri, uri) == 0) {
button = quick_box_get_child_from_uri (quick_box, uri);
-
+
if (button != NULL) {
int button_pos;
button_pos = quick_box_get_child_position (quick_box, button);
@@ -868,35 +869,35 @@ drag_data_received (GtkWidget *widget,
launcher_list_changed = TRUE;
}
}
-
+
g_free (uri);
continue;
}
-
+
g_free (uri);
uri = quick_lounge_util__get_unique_uri (quick_lounge);
-
+
if (! file_copy (src_uri, uri)) {
g_free (uri);
continue;
}
-
+
quick_box_add_button (quick_box, uri, pos++);
launcher_list_changed = TRUE;
-
+
g_free (uri);
}
else {
GKeyFile *desktop_entry;
-
+
desktop_entry = _g_desktop_entry_new_for_uri (src_uri);
- if (quick_lounge_add_launcher (quick_lounge, desktop_entry, pos))
+ if (quick_lounge_add_launcher (quick_lounge, desktop_entry, pos))
launcher_list_changed = TRUE;
-
+
g_key_file_free (desktop_entry);
}
}
-
+
if (launcher_list_changed) {
quick_lounge_save_order (quick_lounge);
dlg_properties_update (quick_lounge->prop_dialog);
@@ -919,7 +920,7 @@ quick_lounge_save_order (QuickLounge *quick_lounge)
for (scan = children; scan; scan = scan->next) {
GtkWidget *child_widget = scan->data;
char *uri;
-
+
if (QUICK_IS_SEPARATOR (child_widget)) {
uri_list = g_slist_prepend (uri_list, g_strdup (""));
continue;
@@ -1184,7 +1185,7 @@ quick_lounge_set_min_visible_cols (QuickLounge *quick_lounge,
int value)
{
gboolean needs_update = FALSE;
-
+
if (value == quick_box_get_min_visible_cols (quick_lounge->quick_box))
return FALSE;
if (value < 0)
@@ -1198,13 +1199,13 @@ quick_lounge_set_min_visible_cols (QuickLounge *quick_lounge,
NULL);
needs_update = TRUE;
}
-
+
quick_box_set_min_visible_cols (quick_lounge->quick_box, value);
panel_applet_gconf_set_int (PANEL_APPLET (quick_lounge->applet),
PREFS_MIN_VISIBLE_COLS,
value,
NULL);
-
+
return needs_update;
}
@@ -1228,7 +1229,7 @@ quick_lounge_set_max_size (QuickLounge *quick_lounge,
NULL);
needs_update = TRUE;
}
-
+
quick_box_set_max_visible_cols (quick_lounge->quick_box, value);
panel_applet_gconf_set_int (PANEL_APPLET (quick_lounge->applet),
PREFS_MAX_VISIBLE_COLS,
@@ -1259,14 +1260,14 @@ quick_lounge_set_rows (QuickLounge *quick_lounge,
static char *
get_unique_dirname (void)
{
- static int n = 0;
+ static int n = 0;
char *base_dir;
char *unique_dir = NULL;
base_dir = g_build_filename (g_get_home_dir (), BASE_DIR, NULL);
make_directory_tree_from_path (base_dir, 0700, NULL);
- while (unique_dir == NULL) {
+ while (unique_dir == NULL) {
char *path;
char *name;
gboolean exists;
@@ -1398,8 +1399,8 @@ quick_lounge_applet_fill (PanelApplet *applet)
quick_lounge);
gtk_drag_dest_set (GTK_WIDGET (quick_lounge->quick_box),
- GTK_DEST_DEFAULT_ALL,
- target_table, G_N_ELEMENTS (target_table),
+ GTK_DEST_DEFAULT_ALL,
+ target_table, G_N_ELEMENTS (target_table),
GDK_ACTION_COPY | GDK_ACTION_MOVE);
g_signal_connect (G_OBJECT (quick_lounge->quick_box),
@@ -1451,18 +1452,18 @@ quick_lounge_applet_fill (PanelApplet *applet)
g_signal_connect (G_OBJECT (applet),
"destroy",
- G_CALLBACK (applet_destroy),
- quick_lounge);
+ G_CALLBACK (applet_destroy),
+ quick_lounge);
g_signal_connect (G_OBJECT (applet),
- "change_orient",
- G_CALLBACK (applet_change_orient),
- quick_lounge);
+ "change_orient",
+ G_CALLBACK (applet_change_orient),
+ quick_lounge);
- g_signal_connect (G_OBJECT (applet),
- "change_size",
- G_CALLBACK (applet_change_size),
- quick_lounge);
+ g_signal_connect (G_OBJECT (applet),
+ "change_size",
+ G_CALLBACK (applet_change_size),
+ quick_lounge);
g_signal_connect (G_OBJECT (applet),
"change_background",
@@ -1470,13 +1471,13 @@ quick_lounge_applet_fill (PanelApplet *applet)
quick_lounge);
g_signal_connect (G_OBJECT (applet),
"size_request",
- G_CALLBACK (applet_size_request),
- quick_lounge);
+ G_CALLBACK (applet_size_request),
+ quick_lounge);
g_signal_connect (G_OBJECT (applet),
"size_allocate",
- G_CALLBACK (applet_size_allocate),
- quick_lounge);
+ G_CALLBACK (applet_size_allocate),
+ quick_lounge);
panel_applet_setup_menu_from_file (applet,
NULL,
@@ -1500,10 +1501,10 @@ quick_lounge_factory (PanelApplet *applet,
const char *iid,
gpointer data)
{
- if (strcmp (iid, APPLET_IID) == 0)
+ if (strcmp (iid, APPLET_IID) == 0)
return quick_lounge_applet_fill (applet);
- return FALSE;
+ return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]