diff --git a/src/sbbs3/gtkmonitor/events.c b/src/sbbs3/gtkmonitor/events.c index 9096023684999fe20698db993d012d4f891874cb..2b622071c4f275a1d6a6053f0366366e4b103504 100644 --- a/src/sbbs3/gtkmonitor/events.c +++ b/src/sbbs3/gtkmonitor/events.c @@ -569,70 +569,6 @@ void close_this_window(GtkWidget *wiggy, gpointer data) gtk_widget_destroy(GTK_WIDGET(gtk_widget_get_toplevel(wiggy))); } -GladeXML *lxml; - -void update_userlist_sensitive_callback(GtkTreeSelection *wiggy, gpointer data) -{ - GtkWidget *w; - int selected; - - w=glade_xml_get_widget(lxml, "bUserListEditUser"); - selected=gtk_tree_selection_count_selected_rows(wiggy); - gtk_widget_set_sensitive(w, selected==1); -} - -void update_userlist_item(GtkListStore *lstore, GtkTreeIter *curr, int usernum) -{ - char sex[2]; - char first[9]; - char last[9]; - user_t user; - - user.number=usernum; - getuserdat(&cfg, &user); - sex[0]=user.sex; - sex[1]=0; - unixtodstr(&cfg, user.firston, first); - unixtodstr(&cfg, user.laston, last); - gtk_list_store_set(lstore, curr - ,0,user.number - ,1,user.alias - ,2,user.name - ,3,user.level - ,4,getage(&cfg, user.birth) - ,5,sex - ,6,user.location - ,7,user.modem - ,8,user.note - ,9,user.comp - ,10,user.phone - ,11,user.netmail - ,12,user.logons - ,13,first - ,14,last - ,15,user.firston - ,16,user.laston - ,-1); -} - -void update_userlist_callback(GtkWidget *wiggy, gpointer data) -{ - GtkWidget *w; - GtkListStore *lstore = NULL; - int totalusers; - int i; - GtkTreeIter curr; - - w=glade_xml_get_widget(lxml, "lUserList"); - lstore=GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(w))); - gtk_list_store_clear(lstore); - totalusers=lastuser(&cfg); - for(i=1; i<=totalusers; i++) { - gtk_list_store_insert(lstore, &curr, i-1); - update_userlist_item(lstore, &curr, i); - } -} - void quick_validate(int usernum, int set) { user_t user; @@ -664,323 +600,10 @@ void quick_validate(int usernum, int set) } } -void userlist_do_quick_validate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) -{ - int *set=data; - int usernum; - - gtk_tree_model_get(model, iter, 0, &usernum, -1); - quick_validate(usernum,*set); - update_userlist_item(GTK_LIST_STORE(model), iter, usernum); -} - -void on_userlist_quick_validate(GtkWidget *wiggy, gpointer data) -{ - int set; - GtkWidget *w; - - w=glade_xml_get_widget(lxml, "lUserList"); - set=gtk_combo_box_get_active(GTK_COMBO_BOX(wiggy))-1; - if(set>=0) { - gtk_tree_selection_selected_foreach(gtk_tree_view_get_selection (GTK_TREE_VIEW (w)) - ,userlist_do_quick_validate - ,&set); - gtk_combo_box_set_active(GTK_COMBO_BOX(wiggy), 0); - } -} - /* Show user list */ on_list1_activate(GtkWidget *wiggy, gpointer data) { - GtkWidget *w; - int i; - char str[1025]; - char flags[33]; - GtkListStore *lstore = NULL; - GtkTreeSelection *lsel; - - lxml = glade_xml_new(glade_path, "UserListWindow", NULL); - if(lxml==NULL) { - fprintf(stderr,"Could not locate UserListWindow widget\n"); - return; - } - /* connect the signals in the interface */ - glade_xml_signal_autoconnect(lxml); - - /* Set up user list */ - w=glade_xml_get_widget(lxml, "lUserList"); - lstore = gtk_list_store_new(17 - ,G_TYPE_INT - ,G_TYPE_STRING - ,G_TYPE_STRING - ,G_TYPE_INT - ,G_TYPE_INT - ,G_TYPE_STRING - ,G_TYPE_STRING - ,G_TYPE_STRING - ,G_TYPE_STRING - ,G_TYPE_STRING - ,G_TYPE_STRING - ,G_TYPE_STRING - ,G_TYPE_INT - ,G_TYPE_STRING - ,G_TYPE_STRING - ,G_TYPE_INT - ,G_TYPE_INT - ); - gtk_tree_view_set_model(GTK_TREE_VIEW(w), GTK_TREE_MODEL(lstore)); - gtk_tree_view_insert_column_with_attributes( - GTK_TREE_VIEW(w) - ,0 - ,"Num" - ,gtk_cell_renderer_text_new() - ,"text" - ,0 - ,NULL); - gtk_tree_view_column_set_sort_column_id( - gtk_tree_view_get_column( - GTK_TREE_VIEW(w), 0 - ) - ,0 - ); - gtk_tree_view_insert_column_with_attributes( - GTK_TREE_VIEW(w) - ,1 - ,"Alias" - ,gtk_cell_renderer_text_new() - ,"text" - ,1 - ,NULL); - gtk_tree_view_column_set_sort_column_id( - gtk_tree_view_get_column( - GTK_TREE_VIEW(w), 1 - ) - ,1 - ); - gtk_tree_view_insert_column_with_attributes( - GTK_TREE_VIEW(w) - ,2 - ,"Name" - ,gtk_cell_renderer_text_new() - ,"text" - ,2 - ,NULL); - gtk_tree_view_column_set_sort_column_id( - gtk_tree_view_get_column( - GTK_TREE_VIEW(w), 2 - ) - ,2 - ); - gtk_tree_view_insert_column_with_attributes( - GTK_TREE_VIEW(w) - ,3 - ,"Lev" - ,gtk_cell_renderer_text_new() - ,"text" - ,3 - ,NULL); - gtk_tree_view_column_set_sort_column_id( - gtk_tree_view_get_column( - GTK_TREE_VIEW(w), 3 - ) - ,3 - ); - gtk_tree_view_insert_column_with_attributes( - GTK_TREE_VIEW(w) - ,4 - ,"Age" - ,gtk_cell_renderer_text_new() - ,"text" - ,4 - ,NULL); - gtk_tree_view_column_set_sort_column_id( - gtk_tree_view_get_column( - GTK_TREE_VIEW(w), 4 - ) - ,4 - ); - gtk_tree_view_insert_column_with_attributes( - GTK_TREE_VIEW(w) - ,5 - ,"Sex" - ,gtk_cell_renderer_text_new() - ,"text" - ,5 - ,NULL); - gtk_tree_view_column_set_sort_column_id( - gtk_tree_view_get_column( - GTK_TREE_VIEW(w), 5 - ) - ,5 - ); - gtk_tree_view_insert_column_with_attributes( - GTK_TREE_VIEW(w) - ,6 - ,"Location" - ,gtk_cell_renderer_text_new() - ,"text" - ,6 - ,NULL); - gtk_tree_view_column_set_sort_column_id( - gtk_tree_view_get_column( - GTK_TREE_VIEW(w), 6 - ) - ,6 - ); - gtk_tree_view_insert_column_with_attributes( - GTK_TREE_VIEW(w) - ,7 - ,"Protocol" - ,gtk_cell_renderer_text_new() - ,"text" - ,7 - ,NULL); - gtk_tree_view_column_set_sort_column_id( - gtk_tree_view_get_column( - GTK_TREE_VIEW(w), 7 - ) - ,7 - ); - gtk_tree_view_insert_column_with_attributes( - GTK_TREE_VIEW(w) - ,8 - ,"Address" - ,gtk_cell_renderer_text_new() - ,"text" - ,8 - ,NULL); - gtk_tree_view_column_set_sort_column_id( - gtk_tree_view_get_column( - GTK_TREE_VIEW(w), 8 - ) - ,8 - ); - gtk_tree_view_insert_column_with_attributes( - GTK_TREE_VIEW(w) - ,9 - ,"Host Name" - ,gtk_cell_renderer_text_new() - ,"text" - ,9 - ,NULL); - gtk_tree_view_column_set_sort_column_id( - gtk_tree_view_get_column( - GTK_TREE_VIEW(w), 9 - ) - ,9 - ); - gtk_tree_view_insert_column_with_attributes( - GTK_TREE_VIEW(w) - ,10 - ,"Phone" - ,gtk_cell_renderer_text_new() - ,"text" - ,10 - ,NULL); - gtk_tree_view_column_set_sort_column_id( - gtk_tree_view_get_column( - GTK_TREE_VIEW(w), 10 - ) - ,10 - ); - gtk_tree_view_insert_column_with_attributes( - GTK_TREE_VIEW(w) - ,11 - ,"Email" - ,gtk_cell_renderer_text_new() - ,"text" - ,11 - ,NULL); - gtk_tree_view_column_set_sort_column_id( - gtk_tree_view_get_column( - GTK_TREE_VIEW(w), 11 - ) - ,11 - ); - gtk_tree_view_insert_column_with_attributes( - GTK_TREE_VIEW(w) - ,12 - ,"Logons" - ,gtk_cell_renderer_text_new() - ,"text" - ,12 - ,NULL); - gtk_tree_view_column_set_sort_column_id( - gtk_tree_view_get_column( - GTK_TREE_VIEW(w), 12 - ) - ,12 - ); - gtk_tree_view_insert_column_with_attributes( - GTK_TREE_VIEW(w) - ,13 - ,"First On" - ,gtk_cell_renderer_text_new() - ,"text" - ,13 - ,NULL); - gtk_tree_view_column_set_sort_column_id( - gtk_tree_view_get_column( - GTK_TREE_VIEW(w), 13 - ) - ,15 - ); - gtk_tree_view_insert_column_with_attributes( - GTK_TREE_VIEW(w) - ,14 - ,"Last On" - ,gtk_cell_renderer_text_new() - ,"text" - ,14 - ,NULL); - gtk_tree_view_column_set_sort_column_id( - gtk_tree_view_get_column( - GTK_TREE_VIEW(w), 14 - ) - ,16 - ); - lsel = gtk_tree_view_get_selection (GTK_TREE_VIEW (w)); - gtk_tree_selection_set_mode (lsel, GTK_SELECTION_MULTIPLE); - g_signal_connect (G_OBJECT (lsel), "changed", G_CALLBACK (update_userlist_sensitive_callback), NULL); - - /* Set up users */ - update_userlist_callback(GTK_WIDGET(w), NULL); - update_userlist_sensitive_callback(lsel, NULL); - - /* Set up quick validation values */ - w=glade_xml_get_widget(lxml, "cQuickValidate"); - gtk_combo_box_set_active(GTK_COMBO_BOX(w), 0); - for(i=0;i<10;i++) { - sprintf(str,"%d SL: %-2d F1: %s",i,cfg.val_level[i],ltoaf(cfg.val_flags1[i],flags)); - gtk_combo_box_append_text(GTK_COMBO_BOX(w), str); - } - - /* Show 'er to the user */ - gtk_window_present(GTK_WINDOW(glade_xml_get_widget(lxml, "UserListWindow"))); -} - -void get_lastselected_user(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) -{ - int *i=data; - int user; - - gtk_tree_model_get(model, iter, 0, &user, -1); - *i=user; -} - -void userlist_edituser(GtkWidget *wiggy, gpointer data) -{ - char str[MAX_PATH+1]; - int i; - GtkWidget *w; - - w=glade_xml_get_widget(lxml, "lUserList"); - gtk_tree_selection_selected_foreach(gtk_tree_view_get_selection (GTK_TREE_VIEW (w)) - ,get_lastselected_user - ,&i); - - sprintf(str,"gtkuseredit %d",i); - run_external(cfg.exec_dir,str); + run_external(cfg.exec_dir,"gtkuserlist"); } void quickvalidate_useron_node(GtkWidget *wiggy, gpointer data) diff --git a/src/sbbs3/gtkmonitor/gtkmonitor.glade b/src/sbbs3/gtkmonitor/gtkmonitor.glade index 7221dc70f3d03245e1fe4c60be1c9a4c0d37f8c5..bafb9864975efdfafa625d3939b442773aed37a0 100644 --- a/src/sbbs3/gtkmonitor/gtkmonitor.glade +++ b/src/sbbs3/gtkmonitor/gtkmonitor.glade @@ -3025,356 +3025,6 @@ Set9</property> <property name="translator_credits" translatable="yes" comments="TRANSLATORS: Replace this string with your names, one name per line.">translator-credits</property> </widget> -<widget class="GtkWindow" id="UserListWindow"> - <property name="visible">True</property> - <property name="title" translatable="yes">User List</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">True</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="icon_name">gtk-index</property> - <property name="decorated">True</property> - <property name="skip_taskbar_hint">False</property> - <property name="skip_pager_hint">False</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - <property name="focus_on_map">True</property> - <property name="urgency_hint">False</property> - - <child> - <widget class="GtkVBox" id="vbox4"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkScrolledWindow" id="scrolledwindow3"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="shadow_type">GTK_SHADOW_IN</property> - <property name="window_placement">GTK_CORNER_TOP_LEFT</property> - - <child> - <widget class="GtkTreeView" id="lUserList"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="headers_visible">True</property> - <property name="rules_hint">False</property> - <property name="reorderable">True</property> - <property name="enable_search">True</property> - <property name="fixed_height_mode">False</property> - <property name="hover_selection">False</property> - <property name="hover_expand">False</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox17"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label20"> - <property name="visible">True</property> - <property name="label" translatable="yes">Quick Validation Sets</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">10</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkComboBox" id="cQuickValidate"> - <property name="visible">True</property> - <property name="items" translatable="yes">Select a set</property> - <property name="add_tearoffs">False</property> - <property name="focus_on_click">True</property> - <signal name="changed" handler="on_userlist_quick_validate" last_modification_time="Thu, 11 May 2006 06:04:08 GMT"/> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="button4"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <signal name="clicked" handler="close_this_window" last_modification_time="Thu, 11 May 2006 04:52:24 GMT"/> - - <child> - <widget class="GtkAlignment" id="alignment5"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkHBox" id="hbox18"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">2</property> - - <child> - <widget class="GtkImage" id="image1359"> - <property name="visible">True</property> - <property name="stock">gtk-quit</property> - <property name="icon_size">4</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label21"> - <property name="visible">True</property> - <property name="label" translatable="yes">Quit</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="bUserListEditUser"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <signal name="clicked" handler="userlist_edituser" last_modification_time="Thu, 11 May 2006 06:09:27 GMT"/> - - <child> - <widget class="GtkAlignment" id="alignment6"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkHBox" id="hbox19"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">2</property> - - <child> - <widget class="GtkImage" id="image1360"> - <property name="visible">True</property> - <property name="stock">gtk-edit</property> - <property name="icon_size">4</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label22"> - <property name="visible">True</property> - <property name="label" translatable="yes">Edit User</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="button7"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <signal name="clicked" handler="update_userlist_callback" last_modification_time="Thu, 11 May 2006 05:33:35 GMT"/> - - <child> - <widget class="GtkAlignment" id="alignment7"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkHBox" id="hbox20"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">2</property> - - <child> - <widget class="GtkImage" id="image1361"> - <property name="visible">True</property> - <property name="stock">gtk-refresh</property> - <property name="icon_size">4</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label23"> - <property name="visible">True</property> - <property name="label" translatable="yes">Refresh</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - </widget> - </child> -</widget> - <widget class="GtkDialog" id="PreferencesDialog"> <property name="visible">True</property> <property name="title" translatable="yes">Preferences</property>