ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gtkbfc/gtkbfc.c
(Generate patch)

Comparing gtkbfc/gtkbfc.c (file contents):
Revision 1.15 by root, Sat Aug 18 14:07:47 2007 UTC vs.
Revision 1.19 by root, Sat Aug 18 15:01:08 2007 UTC

10#include <unistd.h> 10#include <unistd.h>
11#include <sys/types.h> 11#include <sys/types.h>
12#include <sys/stat.h> 12#include <sys/stat.h>
13#include <fcntl.h> 13#include <fcntl.h>
14 14
15static const char gtkbfc_version_string[] = "gtkbfc version 0.0";
16
15static char *helper = "/etc/gtkbfc-helper"; 17static char *helper = "/etc/gtkbfc-helper";
16 18
17static GObject *(*old_constructor) (GType type, guint n_construct_properties, GObjectConstructParam *construct_properties); 19static GObject *(*old_constructor) (GType type, guint n_construct_properties, GObjectConstructParam *construct_properties);
18 20
19static gchar *last_path; 21static gchar *last_path;
73static const gchar * 75static const gchar *
74from_uri (const gchar *uri) 76from_uri (const gchar *uri)
75{ 77{
76 const gchar *rv = uri; 78 const gchar *rv = uri;
77 79
78 if (uri && uri == strstr (uri, "file:///")) 80 if (!strncmp (uri, "file:///", sizeof ("file:///") - 1))
79 rv = uri + 7; 81 rv += sizeof ("file:///") - 1;
80 82
81 return rv; 83 return rv;
82} 84}
83 85
84static gchar * 86static gchar *
87 gchar *rv = NULL; 89 gchar *rv = NULL;
88 90
89 if (file) 91 if (file)
90 { 92 {
91 GString *str = g_string_new ("file://"); 93 GString *str = g_string_new ("file://");
92
93 str = g_string_append (str, file); 94 str = g_string_append (str, file);
94 rv = g_strdup (str->str); 95 rv = g_strdup (str->str);
95 g_string_free (str, TRUE); 96 g_string_free (str, TRUE);
96 g_free (file); 97 g_free (file);
97 } 98 }
118} 119}
119 120
120gchar *gtk_file_chooser_get_uri (GtkFileChooser *chooser) 121gchar *gtk_file_chooser_get_uri (GtkFileChooser *chooser)
121{ 122{
122 gchar *uri = to_uri(gtk_file_chooser_get_filename (chooser)); 123 gchar *uri = to_uri(gtk_file_chooser_get_filename (chooser));
123 DEBUG ((printf ("gtk_file_chooser_get_uri<%s>\n", uri))); 124 DEBUG ((printf ("gtk_file_chooser_get_uri<%s>\n", uri)))
124 return uri; 125 return uri;
125} 126}
126 127
127gboolean gtk_file_chooser_set_uri (GtkFileChooser *chooser, const char *uri) 128gboolean gtk_file_chooser_set_uri (GtkFileChooser *chooser, const char *uri)
128{ 129{
152 153
153 GtkWidget *toplevel = gtk_widget_get_toplevel (data); 154 GtkWidget *toplevel = gtk_widget_get_toplevel (data);
154 if (toplevel) gtk_widget_set_sensitive (toplevel, 0); 155 if (toplevel) gtk_widget_set_sensitive (toplevel, 0);
155 156
156 gtk_widget_unref (data); 157 gtk_widget_unref (data);
157
158 return FALSE; 158 return FALSE;
159} 159}
160 160
161static gboolean read_result (GIOChannel *source, GIOCondition condition, gpointer data) 161static gboolean read_result (GIOChannel *source, GIOCondition condition, gpointer data)
162{ 162{
190 gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (data), FALSE); 190 gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (data), FALSE);
191 g_signal_emit_by_name (GTK_FILE_CHOOSER (data), "file-activated"); 191 g_signal_emit_by_name (GTK_FILE_CHOOSER (data), "file-activated");
192 } 192 }
193 193
194 gtk_widget_unref (data); 194 gtk_widget_unref (data);
195
196 return FALSE; 195 return FALSE;
197} 196}
198 197
199static gboolean map_cb (GtkWidget *widget, gpointer user_data) 198static gboolean map_cb (GtkWidget *widget, gpointer user_data)
200{ 199{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines