[ghex] Remove support for broken GDK_ACTION_ASK



commit 95ecb061478cc8c3c7f0e2edea6e1c55e967fc91
Author: Kalev Lember <kalevlember gmail com>
Date:   Sun Jul 31 22:47:53 2011 +0300

    Remove support for broken GDK_ACTION_ASK
    
    It was entirely broken with the popup dialog completely missing from the
    bonobo UI file. Apparently it has never worked and nobody has noticed
    either for the past 10 years. Removed the whole thing.
    
    Bonobo-WARNING **: Can't find path '/popups/DnD' for popup widget

 src/ghex-window.c |  112 +++++++++++++++++++++++------------------------------
 src/ghex-window.h |    2 -
 src/ui.c          |   33 ---------------
 3 files changed, 48 insertions(+), 99 deletions(-)
---
diff --git a/src/ghex-window.c b/src/ghex-window.c
index 998b751..04bdb0c 100644
--- a/src/ghex-window.c
+++ b/src/ghex-window.c
@@ -51,74 +51,58 @@ ghex_window_drag_data_received(GtkWidget *widget,
                                guint info, guint time)
 {
     GHexWindow *win = GHEX_WINDOW(widget);
+    GtkWidget *newwin;
+    gchar **uri;
+    gchar **uris_to_open;
 
-	if (info != TARGET_URI_LIST)
-		return;
+    if (info != TARGET_URI_LIST)
+        return;
 
-    win->uris_to_open = g_strsplit(gtk_selection_data_get_data(selection_data), "\r\n", 0);
-    if (gdk_drag_context_get_suggested_action(context) == GDK_ACTION_ASK) {
-        GtkWidget *menu = gtk_menu_new ();
-		
-        bonobo_window_add_popup (BONOBO_WINDOW (win), 
-                                 GTK_MENU (menu), 
-                                 "/popups/DnD");
-        gtk_menu_popup (GTK_MENU (menu),
-                        NULL,
-                        NULL,
-                        NULL,
-                        NULL,
-                        0,
-                        GDK_CURRENT_TIME);
-    }
-    else {
-        GtkWidget *newwin;
-        gchar **uri = win->uris_to_open;
-        
-        if(win->gh == NULL)
-            newwin = GTK_WIDGET(win);
-        else
-            newwin = NULL;
-        while(*uri) {
-            GError *err = NULL;
-            gchar *filename = g_filename_from_uri(*uri, NULL, &err);
-
-            uri++;
-            if(filename == NULL) {
-                GtkWidget *dlg;
-                dlg = gtk_message_dialog_new(GTK_WINDOW(win),
-                                             GTK_DIALOG_MODAL,
-                                             GTK_MESSAGE_ERROR,
-                                             GTK_BUTTONS_OK,
-                                             _("Can not open URI:\n%s"),
-                                             err->message);
-                g_error_free(err);
-                continue;
-            }
+    if (win->gh == NULL)
+        newwin = GTK_WIDGET (win);
+    else
+        newwin = NULL;
+
+    uri = uris_to_open = g_strsplit (gtk_selection_data_get_data (selection_data), "\r\n", 0);
+    while (*uri) {
+        GError *err = NULL;
+        gchar *filename = g_filename_from_uri (*uri, NULL, &err);
+
+        uri++;
+        if (filename == NULL) {
+            GtkWidget *dlg;
+            dlg = gtk_message_dialog_new (GTK_WINDOW (win),
+                                          GTK_DIALOG_MODAL,
+                                          GTK_MESSAGE_ERROR,
+                                          GTK_BUTTONS_OK,
+                                          _("Can not open URI:\n%s"),
+                                          err->message);
+            g_error_free (err);
+            continue;
+        }
 
-	    	if(newwin == NULL)
-                newwin = ghex_window_new();
-            if(ghex_window_load(GHEX_WINDOW(newwin), filename)) {
-                if(newwin != GTK_WIDGET(win))
-                    gtk_widget_show(newwin);
-                newwin = NULL;
-            }
-            else {
-                GtkWidget *dlg;
-                dlg = gtk_message_dialog_new(GTK_WINDOW(win),
-                                             GTK_DIALOG_MODAL,
-                                             GTK_MESSAGE_ERROR,
-                                             GTK_BUTTONS_OK,
-                                             _("Can not open file:\n%s"),
-                                             filename);
-                gtk_widget_show(dlg);
-                gtk_dialog_run(GTK_DIALOG(dlg));
-                gtk_widget_destroy(dlg);
-            }
-            g_free(filename);
+        if (newwin == NULL)
+            newwin = ghex_window_new ();
+        if (ghex_window_load (GHEX_WINDOW (newwin), filename)) {
+            if (newwin != GTK_WIDGET (win))
+                gtk_widget_show (newwin);
+            newwin = NULL;
+        }
+        else {
+            GtkWidget *dlg;
+            dlg = gtk_message_dialog_new (GTK_WINDOW (win),
+                                          GTK_DIALOG_MODAL,
+                                          GTK_MESSAGE_ERROR,
+                                          GTK_BUTTONS_OK,
+                                          _("Can not open file:\n%s"),
+                                          filename);
+            gtk_widget_show (dlg);
+            gtk_dialog_run (GTK_DIALOG (dlg));
+            gtk_widget_destroy (dlg);
         }
-        g_strfreev(win->uris_to_open);
-        win->uris_to_open = NULL;
+        g_free (filename);
     }
+    g_strfreev (uris_to_open);
 }
 
 gboolean
@@ -473,7 +457,7 @@ ghex_window_new(void)
                        GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
                        drag_types,
                        sizeof (drag_types) / sizeof (drag_types[0]),
-                       GDK_ACTION_COPY | GDK_ACTION_ASK);
+                       GDK_ACTION_COPY);
 
 	/* add menu and toolbar */
 	ui_container = bonobo_window_get_ui_container(BONOBO_WINDOW(win));
diff --git a/src/ghex-window.h b/src/ghex-window.h
index f7b1097..ae7f2a9 100644
--- a/src/ghex-window.h
+++ b/src/ghex-window.h
@@ -44,8 +44,6 @@ struct _GHexWindow
     GtkWidget *dialog_widget;
 
     struct _AdvancedFindDialog *advanced_find_dialog;
-
-    gchar **uris_to_open;
 };
 
 struct _GHexWindowClass
diff --git a/src/ui.c b/src/ui.c
index 46d337c..3584243 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -72,10 +72,6 @@ static void paste_cb (BonoboUIComponent *uic, gpointer user_data,
 					  const gchar* verbname);
 static void help_cb (BonoboUIComponent *uic, gpointer user_data,
 					 const gchar* verbname);
-static void DnDNewWindow_cb(BonoboUIComponent *uic, gpointer user_data,
-							const char *cname);
-static void DnDCancel_cb(BonoboUIComponent *uic, gpointer user_data,
-						 const char *cname);
 
 guint group_type[3] = {
 	GROUP_BYTE,
@@ -119,38 +115,9 @@ BonoboUIVerb ghex_verbs [] = {
 	BONOBO_UI_VERB ("Preferences", prefs_cb),
 	BONOBO_UI_VERB ("About", about_cb),
 	BONOBO_UI_VERB ("Help", help_cb),
-	BONOBO_UI_VERB ("DnDNewWindow", DnDNewWindow_cb),
-	BONOBO_UI_VERB ("DnDCancel", DnDCancel_cb),
 	BONOBO_UI_VERB_END
 };
 
-static void
-DnDNewWindow_cb(BonoboUIComponent *uic, gpointer user_data, const char *cname)
-{
-	GHexWindow *win = GHEX_WINDOW(user_data);
-	gchar **uri;
-
-	uri = win->uris_to_open;
-	while(*uri) {
-		GtkWidget *newwin;
-		if(!g_ascii_strncasecmp("file:", *uri, 5)) {
-			newwin = ghex_window_new_from_file((*uri) + 5);
-			gtk_widget_show(newwin);
-		}
-		uri++;
-	}
-	g_strfreev(win->uris_to_open);
-	win->uris_to_open = NULL;
-}
-
-static void
-DnDCancel_cb(BonoboUIComponent *uic, gpointer user_data, const char *cname)
-{
-        GHexWindow *win = GHEX_WINDOW(user_data);
-        g_strfreev(win->uris_to_open);
-        win->uris_to_open = NULL;	
-}
-
 void
 cancel_cb(GtkWidget *w, GtkWidget *me)
 {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]