"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/menus.c" between
etherape-0.9.17.tar.gz and etherape-0.9.18.tar.gz

About: EtherApe is a GNOME/pcap-based graphical network monitor (etherman clone).

menus.c  (etherape-0.9.17):menus.c  (etherape-0.9.18)
skipping to change at line 60 skipping to change at line 60
if (!interfaces) if (!interfaces)
{ {
g_my_info (_("No suitables interfaces for capture have been found")); g_my_info (_("No suitables interfaces for capture have been found"));
if (err_str) if (err_str)
g_string_free(err_str, TRUE); g_string_free(err_str, TRUE);
return; return;
} }
if (err_str) if (err_str)
g_string_free(err_str, TRUE); g_string_free(err_str, TRUE);
widget = glade_xml_get_widget (appdata.xml, "interfaces_menu"); widget = GTK_WIDGET(gtk_builder_get_object(appdata.xml, "interfaces_menu"));
info_string = g_string_new (_("Available interfaces for capture:")); info_string = g_string_new (_("Available interfaces for capture:"));
/* Set up a hidden dummy interface to set when there is no active /* Set up a hidden dummy interface to set when there is no active
* interface */ * interface */
item = gtk_radio_menu_item_new_with_label (group, "apedummy"); item = gtk_radio_menu_item_new_with_label (group, "apedummy");
group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item)); group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item));
gtk_menu_shell_append (GTK_MENU_SHELL (widget), item); gtk_menu_shell_append (GTK_MENU_SHELL (widget), item);
/* Set up the real interfaces menu entries */ /* Set up the real interfaces menu entries */
skipping to change at line 105 skipping to change at line 105
void on_open_activate(GtkMenuItem * menuitem, gpointer user_data) void on_open_activate(GtkMenuItem * menuitem, gpointer user_data)
{ {
GtkWidget *dialog; GtkWidget *dialog;
if (!gui_stop_capture ()) if (!gui_stop_capture ())
return; return;
dialog = gtk_file_chooser_dialog_new ("Open Capture File", dialog = gtk_file_chooser_dialog_new ("Open Capture File",
NULL, NULL,
GTK_FILE_CHOOSER_ACTION_OPEN, GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, _("_Cancel"), GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, _("_Open"), GTK_RESPONSE_ACCEPT,
NULL); NULL);
if (appdata.source.type == ST_FILE && appdata.source.file) if (appdata.source.type == ST_FILE && appdata.source.file)
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), appdata.source.file) ; gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), appdata.source.file) ;
if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
{ {
GtkRecentManager *manager; GtkRecentManager *manager;
manager = gtk_recent_manager_get_default (); manager = gtk_recent_manager_get_default ();
gtk_recent_manager_add_item (manager, gtk_file_chooser_get_uri(GTK_FILE_CH OOSER (dialog))); gtk_recent_manager_add_item (manager, gtk_file_chooser_get_uri(GTK_FILE_CH OOSER (dialog)));
skipping to change at line 135 skipping to change at line 135
gtk_widget_destroy (dialog); gtk_widget_destroy (dialog);
} }
void on_export_activate (GtkMenuItem * menuitem, gpointer user_data) void on_export_activate (GtkMenuItem * menuitem, gpointer user_data)
{ {
GtkWidget *dialog; GtkWidget *dialog;
dialog = gtk_file_chooser_dialog_new ("Export to XML File", dialog = gtk_file_chooser_dialog_new ("Export to XML File",
NULL, NULL,
GTK_FILE_CHOOSER_ACTION_SAVE, GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, _("_Cancel"), GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, _("_Save"), GTK_RESPONSE_ACCEPT,
NULL); NULL);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRU E); gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRU E);
if (appdata.export_file) if (appdata.export_file)
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), appdata.export_file) ; gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), appdata.export_file) ;
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
{ {
GtkRecentManager *manager; GtkRecentManager *manager;
manager = gtk_recent_manager_get_default (); manager = gtk_recent_manager_get_default ();
skipping to change at line 288 skipping to change at line 288
void edit_prefs_show_toolbar(struct pref_struct *p, void *data) void edit_prefs_show_toolbar(struct pref_struct *p, void *data)
{ {
p->show_toolbar = *(gboolean*)data; p->show_toolbar = *(gboolean*)data;
} }
void on_toolbar_check_activate(GtkCheckMenuItem * menuitem, gpointer user_data) void on_toolbar_check_activate(GtkCheckMenuItem * menuitem, gpointer user_data)
{ {
GtkWidget *widget; GtkWidget *widget;
gboolean active = gtk_check_menu_item_get_active(menuitem); gboolean active = gtk_check_menu_item_get_active(menuitem);
widget = glade_xml_get_widget(appdata.xml, "handlebox_toolbar"); widget = GTK_WIDGET(gtk_builder_get_object(appdata.xml, "toolbar"));
if (active) if (active)
gtk_widget_show(widget); gtk_widget_show(widget);
else else
gtk_widget_hide(widget); gtk_widget_hide(widget);
pref.show_toolbar = active; pref.show_toolbar = active;
mutate_saved_config(edit_prefs_show_toolbar, &active); mutate_saved_config(edit_prefs_show_toolbar, &active);
} }
void edit_prefs_show_legend(struct pref_struct *p, void *data) void edit_prefs_show_legend(struct pref_struct *p, void *data)
{ {
p->show_legend = *(gboolean*)data; p->show_legend = *(gboolean*)data;
} }
void on_legend_check_activate(GtkCheckMenuItem * menuitem, gpointer user_data) void on_legend_check_activate(GtkCheckMenuItem * menuitem, gpointer user_data)
{ {
GtkWidget *widget; GtkWidget *widget;
gboolean active = gtk_check_menu_item_get_active(menuitem); gboolean active = gtk_check_menu_item_get_active(menuitem);
widget = glade_xml_get_widget(appdata.xml, "handlebox_legend"); widget = GTK_WIDGET(gtk_builder_get_object(appdata.xml, "legend_frame"));
if (active) if (active)
gtk_widget_show(widget); gtk_widget_show(widget);
else else
gtk_widget_hide(widget); gtk_widget_hide(widget);
pref.show_legend = active; pref.show_legend = active;
mutate_saved_config(edit_prefs_show_legend, &active); mutate_saved_config(edit_prefs_show_legend, &active);
} }
void edit_prefs_show_statusbar(struct pref_struct *p, void *data) void edit_prefs_show_statusbar(struct pref_struct *p, void *data)
skipping to change at line 341 skipping to change at line 341
pref.show_statusbar = active; pref.show_statusbar = active;
mutate_saved_config(edit_prefs_show_statusbar, &active); mutate_saved_config(edit_prefs_show_statusbar, &active);
} }
/* Help menu */ /* Help menu */
void on_about1_activate(GtkMenuItem * menuitem, gpointer user_data) void on_about1_activate(GtkMenuItem * menuitem, gpointer user_data)
{ {
GtkWidget *about; GtkWidget *about;
about = glade_xml_get_widget (appdata.xml, "about1"); about = GTK_WIDGET(gtk_builder_get_object (appdata.xml, "about1"));
gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(about), VERSION); gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(about), VERSION);
#ifdef PACKAGE_SCM_REV #ifdef PACKAGE_SCM_REV
msg = g_strdup_printf("HG revision: %s", msg = g_strdup_printf("HG revision: %s",
(*PACKAGE_SCM_REV) ? PACKAGE_SCM_REV : _("-unknown-")); (*PACKAGE_SCM_REV) ? PACKAGE_SCM_REV : _("-unknown-"));
gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(about), msg); gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(about), msg);
g_free(msg); g_free(msg);
#endif #endif
gtk_widget_show (about); gtk_widget_show (about);
} /* on_about1_activate */ } /* on_about1_activate */
void on_help_activate(GtkMenuItem * menuitem, gpointer user_data) void on_help_activate(GtkMenuItem * menuitem, gpointer user_data)
{ {
GError *err = NULL; GError *err = NULL;
#if GTK_CHECK_VERSION(3,22,0)
#if GTK_CHECK_VERSION(2, 13, 1) gtk_show_uri_on_window(NULL, "help:" PACKAGE_NAME, GDK_CURRENT_TIME, &err);
gtk_show_uri (NULL, "help:" PACKAGE_NAME, GDK_CURRENT_TIME, &err);
#else #else
gnome_help_display (PACKAGE_NAME ".xml", NULL, &err); gtk_show_uri (NULL, "help:" PACKAGE_NAME, GDK_CURRENT_TIME, &err);
#endif #endif
} }
/* Helper functions */ /* Helper functions */
#define EN_PLAY 1 #define EN_PLAY 1
#define EN_PAUSE 2 #define EN_PAUSE 2
#define EN_NEXT 4 #define EN_NEXT 4
#define EN_STOP 8 #define EN_STOP 8
static inline void set_widget_enabled_by_id(const gchar *id, gboolean onoff) static inline void set_widget_enabled_by_id(const gchar *id, gboolean onoff)
{ {
GtkWidget *w = glade_xml_get_widget(appdata.xml, id); GtkWidget *w = GTK_WIDGET(gtk_builder_get_object(appdata.xml, id));
gtk_widget_set_sensitive(w, onoff); gtk_widget_set_sensitive(w, onoff);
} }
static void set_ctrl_enablestate(guint32 flags) static void set_ctrl_enablestate(guint32 flags)
{ {
set_widget_enabled_by_id("start_button", !!(flags & EN_PLAY)); set_widget_enabled_by_id("start_button", !!(flags & EN_PLAY));
set_widget_enabled_by_id("start_menuitem", !!(flags & EN_PLAY)); set_widget_enabled_by_id("start_menuitem", !!(flags & EN_PLAY));
set_widget_enabled_by_id("pause_button", !!(flags & EN_PAUSE)); set_widget_enabled_by_id("pause_button", !!(flags & EN_PAUSE));
set_widget_enabled_by_id("pause_menuitem", !!(flags & EN_PAUSE)); set_widget_enabled_by_id("pause_menuitem", !!(flags & EN_PAUSE));
set_widget_enabled_by_id("next_button", !!(flags & EN_NEXT)); set_widget_enabled_by_id("next_button", !!(flags & EN_NEXT));
skipping to change at line 435 skipping to change at line 434
/* Enable and disable control buttons */ /* Enable and disable control buttons */
set_ctrl_enablestate(EN_STOP|EN_PAUSE|(appdata.source.type == ST_FILE ? EN_NEX T : 0)); set_ctrl_enablestate(EN_STOP|EN_PAUSE|(appdata.source.type == ST_FILE ? EN_NEX T : 0));
/* Enable and disable link layer menu */ /* Enable and disable link layer menu */
set_widget_enabled_by_id("link_radio", has_linklevel()); set_widget_enabled_by_id("link_radio", has_linklevel());
/* Set active mode in GUI */ /* Set active mode in GUI */
switch (appdata.mode) switch (appdata.mode)
{ {
case LINK6: case LINK6:
widget = glade_xml_get_widget (appdata.xml, "link_radio"); widget = GTK_WIDGET(gtk_builder_get_object(appdata.xml, "link_radio"));
break; break;
case IP: case IP:
widget = glade_xml_get_widget (appdata.xml, "ip_radio"); widget = GTK_WIDGET(gtk_builder_get_object(appdata.xml, "ip_radio"));
break; break;
case TCP: case TCP:
widget = glade_xml_get_widget (appdata.xml, "tcp_radio"); widget = GTK_WIDGET(gtk_builder_get_object(appdata.xml, "tcp_radio"));
break; break;
default: default:
g_warning (_("Invalid mode: %d"), appdata.mode); g_warning (_("Invalid mode: %d"), appdata.mode);
return; return;
} }
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (widget), TRUE); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (widget), TRUE);
/* Set the interface in GUI */ /* Set the interface in GUI */
set_active_interface (); set_active_interface ();
skipping to change at line 531 skipping to change at line 530
set_ctrl_enablestate(EN_PLAY); set_ctrl_enablestate(EN_PLAY);
/* Sets the statusbar */ /* Sets the statusbar */
status_string = g_string_new (""); status_string = g_string_new ("");
g_string_printf(status_string, _("Replay from file '%s' completed."), appdata. source.file); g_string_printf(status_string, _("Replay from file '%s' completed."), appdata. source.file);
set_statusbar_msg (status_string->str); set_statusbar_msg (status_string->str);
g_string_free (status_string, TRUE); g_string_free (status_string, TRUE);
} /* gui_stop_capture */ } /* gui_stop_capture */
/* Sets up the GUI to reflect changes and calls stop_capture() */ /* Sets up the GUI to reflect changes and calls stop_capture() */
gboolean gboolean gui_stop_capture (void)
gui_stop_capture (void)
{ {
GString *status_string = NULL; GString *status_string = NULL;
gchar *err; gchar *err;
stop_requested = FALSE; stop_requested = FALSE;
if (get_capture_status() == STOP) if (get_capture_status() == STOP)
return TRUE; return TRUE;
/* /*
* gui_stop_capture needs to call update_diagram in order to * gui_stop_capture needs to call update_diagram in order to
skipping to change at line 567 skipping to change at line 565
g_error("Failed to stop capture: %s", err); g_error("Failed to stop capture: %s", err);
g_free(err); g_free(err);
return FALSE; return FALSE;
} }
set_ctrl_enablestate(EN_PLAY); set_ctrl_enablestate(EN_PLAY);
/* Delete and free protocol information */ /* Delete and free protocol information */
delete_gui_protocols (); delete_gui_protocols ();
update_diagram (canvas_widget()); /* final diagram update */
update_diagram_callback(NULL);
/* Sets the statusbar */ /* Sets the statusbar */
status_string = g_string_new (_("Ready to capture from ")); status_string = g_string_new (_("Ready to capture from "));
if (appdata.source.type == ST_FILE && appdata.source.file) if (appdata.source.type == ST_FILE && appdata.source.file)
g_string_append (status_string, appdata.source.file); g_string_append (status_string, appdata.source.file);
else if (appdata.source.interface) else if (appdata.source.interface)
g_string_append (status_string, appdata.source.interface); g_string_append (status_string, appdata.source.interface);
else else
g_string_append (status_string, _("default interface")); g_string_append (status_string, _("default interface"));
skipping to change at line 619 skipping to change at line 618
label = gtk_label_get_text(GTK_LABEL(gtk_bin_get_child(GTK_BIN(widget)))); label = gtk_label_get_text(GTK_LABEL(gtk_bin_get_child(GTK_BIN(widget))));
if (appdata.source.type == ST_LIVE && !strcmp(label, appdata.source.interface) ) if (appdata.source.type == ST_LIVE && !strcmp(label, appdata.source.interface) )
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(widget), TRUE); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(widget), TRUE);
} }
void set_active_interface() void set_active_interface()
{ {
GtkWidget *widget; GtkWidget *widget;
widget = glade_xml_get_widget(appdata.xml, "interfaces_menu"); widget = GTK_WIDGET(gtk_builder_get_object(appdata.xml, "interfaces_menu"));
gtk_container_foreach(GTK_CONTAINER(widget), setmenus, (gpointer)NULL); gtk_container_foreach(GTK_CONTAINER(widget), setmenus, (gpointer)NULL);
} }
 End of changes. 15 change blocks. 
20 lines changed or deleted 19 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)