ec_gtk3.c (ettercap-0.8.3) | : | ec_gtk3.c (ettercap-0.8.3.1) | ||
---|---|---|---|---|
skipping to change at line 157 | skipping to change at line 157 | |||
static gboolean gtkui_fatal_error_shim(gpointer data) { | static gboolean gtkui_fatal_error_shim(gpointer data) { | |||
gtkui_fatal_error(data); | gtkui_fatal_error(data); | |||
SAFE_FREE(data); | SAFE_FREE(data); | |||
return FALSE; | return FALSE; | |||
} | } | |||
static void gtkui_fatal_error_wrap(const char *msg) { | static void gtkui_fatal_error_wrap(const char *msg) { | |||
char *copy = strdup(msg); | char *copy = strdup(msg); | |||
if (msg) { | if (msg) { | |||
g_idle_add(gtkui_fatal_error_shim, copy); | gtkui_fatal_error_shim(copy); | |||
//g_idle_add(gtkui_fatal_error_shim, copy); | ||||
} else { | } else { | |||
FATAL_ERROR("out of memory"); | FATAL_ERROR("out of memory"); | |||
} | } | |||
} | } | |||
struct gtkui_input_data { | struct gtkui_input_data { | |||
char *title; | char *title; | |||
char *input; | char *input; | |||
size_t n; | size_t n; | |||
void (*callback)(void); | void (*callback)(void); | |||
skipping to change at line 912 | skipping to change at line 913 | |||
DEBUG_MSG("gtkui_start"); | DEBUG_MSG("gtkui_start"); | |||
idle_flush = g_timeout_add(500, gtkui_flush_msg, NULL); | idle_flush = g_timeout_add(500, gtkui_flush_msg, NULL); | |||
/* which interface do we have to display ? */ | /* which interface do we have to display ? */ | |||
online = (EC_GBL_OPTIONS->read ? 0 : 1); | online = (EC_GBL_OPTIONS->read ? 0 : 1); | |||
/* create second instance of the UI application */ | /* create second instance of the UI application */ | |||
etterapp = gtkui_setup(gtkui_create_menu, GINT_TO_POINTER(online)); | etterapp = gtkui_setup(gtkui_create_menu, GINT_TO_POINTER(online)); | |||
/* start plugins defined on CLI */ | ||||
g_idle_add(gtkui_plugins_autostart, NULL); | ||||
/* the main gui loop, once this exits the gui will be destroyed */ | /* the main gui loop, once this exits the gui will be destroyed */ | |||
g_application_run(G_APPLICATION(etterapp), 0, NULL); | g_application_run(G_APPLICATION(etterapp), 0, NULL); | |||
g_object_unref(G_OBJECT(etterapp)); | g_object_unref(G_OBJECT(etterapp)); | |||
g_source_remove(idle_flush); | g_source_remove(idle_flush); | |||
} | } | |||
static void toggle_unoffensive(GSimpleAction *action, GVariant *value, gpointer data) | static void toggle_unoffensive(GSimpleAction *action, GVariant *value, gpointer data) | |||
{ | { | |||
(void) data; | (void) data; | |||
skipping to change at line 1740 | skipping to change at line 1744 | |||
(void) action; | (void) action; | |||
(void) value; | (void) value; | |||
(void) data; | (void) data; | |||
num = gtk_notebook_get_current_page(GTK_NOTEBOOK (notebook)); | num = gtk_notebook_get_current_page(GTK_NOTEBOOK (notebook)); | |||
child = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), num); | child = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), num); | |||
gtkui_page_close(NULL, child); | gtkui_page_close(NULL, child); | |||
} | } | |||
/* show the context menu when the notebook tabs recieve a mouse right-click */ | /* show the context menu when the notebook tabs receive a mouse right-click */ | |||
gboolean gtkui_context_menu(GtkWidget *widget, GdkEventButton *event, gpointer d ata) { | gboolean gtkui_context_menu(GtkWidget *widget, GdkEventButton *event, gpointer d ata) { | |||
/* variable not used */ | /* variable not used */ | |||
(void) widget; | (void) widget; | |||
if(event->button == 3) { | if(event->button == 3) { | |||
#if GTK_CHECK_VERSION(3,22,0) | #if GTK_CHECK_VERSION(3,22,0) | |||
gtk_menu_popup_at_pointer(GTK_MENU(data), (GdkEvent*)event); | gtk_menu_popup_at_pointer(GTK_MENU(data), (GdkEvent*)event); | |||
#else | #else | |||
gtk_menu_popup(GTK_MENU(data), NULL, NULL, NULL, NULL, 3, event->time); | gtk_menu_popup(GTK_MENU(data), NULL, NULL, NULL, NULL, 3, event->time); | |||
#endif | #endif | |||
skipping to change at line 1850 | skipping to change at line 1854 | |||
gtk_widget_destroy(dialog); | gtk_widget_destroy(dialog); | |||
} | } | |||
/* make sure data is valid UTF8 */ | /* make sure data is valid UTF8 */ | |||
char *gtkui_utf8_validate(char *data) { | char *gtkui_utf8_validate(char *data) { | |||
const gchar *end; | const gchar *end; | |||
char *unicode = NULL; | char *unicode = NULL; | |||
unicode = data; | unicode = data; | |||
if(!g_utf8_validate (data, -1, &end)) { | if(!g_utf8_validate (data, -1, &end)) { | |||
/* if "end" pointer is at begining of string, we have no valid text to pri nt */ | /* if "end" pointer is at beginning of string, we have no valid text to pr int */ | |||
if(end == unicode) return(NULL); | if(end == unicode) return(NULL); | |||
/* cut off the invalid part so we don't lose the whole string */ | /* cut off the invalid part so we don't lose the whole string */ | |||
/* this shouldn't happen often */ | /* this shouldn't happen often */ | |||
unicode = (char *)end; | unicode = (char *)end; | |||
*unicode = 0; | *unicode = 0; | |||
unicode = data; | unicode = data; | |||
} | } | |||
return(unicode); | return(unicode); | |||
End of changes. 4 change blocks. | ||||
3 lines changed or deleted | 7 lines changed or added |