static void removeEventHandler(BalloonEval *beval) { /* LINTED: avoid warning: dubious operation on enum */ # if GTK_CHECK_VERSION(3,0,0) g_signal_handlers_disconnect_by_func(G_OBJECT(beval->target), FUNC2GENERIC(target_event_cb), beval); # else gtk_signal_disconnect_by_func((GtkObject*)(beval->target), GTK_SIGNAL_FUNC(target_event_cb), beval); # endif if (gtk_socket_id == 0 && gui.mainwin != NULL && gtk_widget_is_ancestor(beval->target, gui.mainwin)) { /* LINTED: avoid warning: dubious operation on enum */ # if GTK_CHECK_VERSION(3,0,0) g_signal_handlers_disconnect_by_func(G_OBJECT(gui.mainwin), FUNC2GENERIC(mainwin_event_cb), beval); # else gtk_signal_disconnect_by_func((GtkObject*)(gui.mainwin), GTK_SIGNAL_FUNC(mainwin_event_cb), beval); # endif } }
void wxComboBox::DisableEvents() { gtk_signal_disconnect_by_func( GTK_OBJECT(GTK_COMBO(m_widget)->list), GTK_SIGNAL_FUNC(gtk_combo_select_child_callback), (gpointer)this ); gtk_signal_disconnect_by_func( GTK_OBJECT(GTK_COMBO(m_widget)->entry), GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this ); }
void wxFrame::DetachMenuBar() { wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid frame") ); if ( m_frameMenuBar ) { m_frameMenuBar->Attach( this ); if (m_frameMenuBar->GetWindowStyle() & wxMB_DOCKABLE) { gtk_signal_disconnect_by_func( GTK_OBJECT(m_frameMenuBar->m_widget), GTK_SIGNAL_FUNC(gtk_menu_attached_callback), (gpointer)this ); gtk_signal_disconnect_by_func( GTK_OBJECT(m_frameMenuBar->m_widget), GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this ); } gtk_widget_ref( m_frameMenuBar->m_widget ); gtk_container_remove( GTK_CONTAINER(m_mainWidget), m_frameMenuBar->m_widget ); } wxFrameBase::DetachMenuBar(); }
void gtkspell_detach(GtkText *gtktext) { gtk_signal_disconnect_by_func(GTK_OBJECT(gtktext), GTK_SIGNAL_FUNC(entry_insert_cb), NULL); gtk_signal_disconnect_by_func(GTK_OBJECT(gtktext), GTK_SIGNAL_FUNC(entry_delete_cb), NULL); gtk_signal_disconnect_by_func(GTK_OBJECT(gtktext), GTK_SIGNAL_FUNC(button_press_intercept_cb), NULL); gtkspell_uncheck_all(gtktext); }
void wxSpinCtrl::GtkDisableEvents() { gtk_signal_disconnect_by_func( GTK_OBJECT(m_adjust), GTK_SIGNAL_FUNC(gtk_spinctrl_callback), (gpointer) this ); gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget), GTK_SIGNAL_FUNC(gtk_spinctrl_text_changed_callback), (gpointer) this ); }
void wxDropSource::UnregisterWindow() { if (!m_widget) return; gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget), GTK_SIGNAL_FUNC(source_drag_data_get), (gpointer) this ); gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget), GTK_SIGNAL_FUNC(source_drag_data_delete), (gpointer) this ); gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget), GTK_SIGNAL_FUNC(source_drag_begin), (gpointer) this ); gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget), GTK_SIGNAL_FUNC(source_drag_end), (gpointer) this ); }
void wxTextCtrl::SetInsertionPoint( long pos ) { wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") ); if ( IsMultiLine() ) { gtk_signal_disconnect_by_func( GTK_OBJECT(m_text), GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this); /* we fake a set_point by inserting and deleting. as the user isn't supposed to get to know about this non-sense, we disconnect so that no events are sent to the user program. */ gint tmp = (gint)pos; gtk_editable_insert_text( GTK_EDITABLE(m_text), " ", 1, &tmp ); gtk_editable_delete_text( GTK_EDITABLE(m_text), tmp-1, tmp ); gtk_signal_connect( GTK_OBJECT(m_text), "changed", GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this); // bring editable's cursor uptodate. Bug in GTK. SET_EDITABLE_POS(m_text, gtk_text_get_point( GTK_TEXT(m_text) )); } else { gtk_entry_set_position( GTK_ENTRY(m_text), (int)pos ); // Bring editable's cursor uptodate. Bug in GTK. SET_EDITABLE_POS(m_text, (guint32)pos); } }
static void translatorchooser_ok_clicked (GtkWidget *widget, TTRANSLATORCHOOSER *choose_t) { char *szTranslator; if (choose_t) { if (GTK_CLIST (choose_t->translatorlist)->selection != NULL) { gtk_clist_get_text (GTK_CLIST (choose_t->translatorlist), GPOINTER_TO_INT (GTK_CLIST (choose_t->translatorlist)-> selection->data), 0, &szTranslator); choose_t->translator = dm_SQL_A2W (szTranslator, SQL_NTS); } else choose_t->translator = NULL; choose_t->translatorlist = NULL; gtk_signal_disconnect_by_func (GTK_OBJECT (choose_t->mainwnd), GTK_SIGNAL_FUNC (gtk_main_quit), NULL); gtk_main_quit (); gtk_widget_destroy (choose_t->mainwnd); } }
void wxTextCtrl::SetMaxLength(unsigned long len) { if ( !HasFlag(wxTE_MULTILINE) ) { gtk_entry_set_max_length(GTK_ENTRY(m_text), len); // there is a bug in GTK+ 1.2.x: "changed" signal is emitted even if // we had tried to enter more text than allowed by max text length and // the text wasn't really changed // // to detect this and generate TEXT_MAXLEN event instead of // TEXT_CHANGED one in this case we also catch "insert_text" signal // // when max len is set to 0 we disconnect our handler as it means that // we shouldn't check anything any more if ( len ) { gtk_signal_connect( GTK_OBJECT(m_text), "insert_text", GTK_SIGNAL_FUNC(gtk_insert_text_callback), (gpointer)this); } else // no checking { gtk_signal_disconnect_by_func ( GTK_OBJECT(m_text), GTK_SIGNAL_FUNC(gtk_insert_text_callback), (gpointer)this ); } } }
static void login_ok_clicked (GtkWidget *widget, TLOGIN *log_t) { if (log_t) { log_t->user = (char *) malloc (sizeof (char) * (STRLEN (gtk_entry_get_text (GTK_ENTRY (log_t->username))) + 1)); log_t->pwd = (char *) malloc (sizeof (char) * (STRLEN (gtk_entry_get_text (GTK_ENTRY (log_t->password))) + 1)); if (log_t->user) strcpy (log_t->user, gtk_entry_get_text (GTK_ENTRY (log_t->username))); if (log_t->pwd) strcpy (log_t->pwd, gtk_entry_get_text (GTK_ENTRY (log_t->password))); log_t->username = log_t->password = NULL; log_t->ok = TRUE; gtk_signal_disconnect_by_func (GTK_OBJECT (log_t->mainwnd), GTK_SIGNAL_FUNC (gtk_main_quit), NULL); gtk_main_quit (); gtk_widget_destroy (log_t->mainwnd); } }
wxNotebookPage *wxNotebook::DoRemovePage( size_t page ) { if ( m_selection != wxNOT_FOUND && (size_t)m_selection >= page ) { // the index will become invalid after the page is deleted m_selection = wxNOT_FOUND; } wxNotebookPage *client = wxNotebookBase::DoRemovePage(page); if ( !client ) return NULL; gtk_widget_ref( client->m_widget ); gtk_widget_unrealize( client->m_widget ); gtk_widget_unparent( client->m_widget ); // gtk_notebook_remove_page() sends "switch_page" signal with some strange // new page index (when deleting selected page 0, new page is 1 although, // clearly, the selection should stay 0), so suppress this gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget), GTK_SIGNAL_FUNC(gtk_notebook_page_change_callback), (gpointer) this ); gtk_notebook_remove_page( GTK_NOTEBOOK(m_widget), page ); gtk_signal_connect( GTK_OBJECT(m_widget), "switch_page", GTK_SIGNAL_FUNC(gtk_notebook_page_change_callback), (gpointer)this ); wxGtkNotebookPage* p = GetNotebookPage(page); m_pagesData.DeleteObject(p); delete p; return client; }
static void removeEventHandler(BalloonEval *beval) { /* LINTED: avoid warning: dubious operation on enum */ gtk_signal_disconnect_by_func((GtkObject*)(beval->target), GTK_SIGNAL_FUNC(target_event_cb), beval); if (gtk_socket_id == 0 && gui.mainwin != NULL && gtk_widget_is_ancestor(beval->target, gui.mainwin)) { /* LINTED: avoid warning: dubious operation on enum */ gtk_signal_disconnect_by_func((GtkObject*)(gui.mainwin), GTK_SIGNAL_FUNC(mainwin_event_cb), beval); } }
static void error_ok_clicked (GtkWidget *widget, GtkWidget *error) { gtk_signal_disconnect_by_func (GTK_OBJECT (error), GTK_SIGNAL_FUNC (gtk_main_quit), NULL); gtk_main_quit (); gtk_widget_destroy (error); }
void wxDropTarget::UnregisterWidget( GtkWidget *widget ) { wxCHECK_RET( widget != NULL, wxT("unregister widget is NULL") ); gtk_drag_dest_unset( widget ); gtk_signal_disconnect_by_func( GTK_OBJECT(widget), GTK_SIGNAL_FUNC(target_drag_leave), (gpointer) this ); gtk_signal_disconnect_by_func( GTK_OBJECT(widget), GTK_SIGNAL_FUNC(target_drag_motion), (gpointer) this ); gtk_signal_disconnect_by_func( GTK_OBJECT(widget), GTK_SIGNAL_FUNC(target_drag_drop), (gpointer) this ); gtk_signal_disconnect_by_func( GTK_OBJECT(widget), GTK_SIGNAL_FUNC(target_drag_data_received), (gpointer) this ); }
static void gtk_spinbutt_callback( GtkWidget *WXUNUSED(widget), wxSpinButton *win ) { if (g_isIdle) wxapp_install_idle_handler(); if (!win->m_hasVMT) return; if (g_blockEventsOnDrag) return; float diff = win->m_adjust->value - win->m_oldPos; if (fabs(diff) < sensitivity) return; wxEventType command = wxEVT_NULL; float line_step = win->m_adjust->step_increment; if (fabs(diff-line_step) < sensitivity) command = wxEVT_SCROLL_LINEUP; else if (fabs(diff+line_step) < sensitivity) command = wxEVT_SCROLL_LINEDOWN; else command = wxEVT_SCROLL_THUMBTRACK; int value = (int)ceil(win->m_adjust->value); wxSpinEvent event( command, win->GetId()); event.SetPosition( value ); event.SetEventObject( win ); if ((win->HandleWindowEvent( event )) && !event.IsAllowed() ) { /* program has vetoed */ win->m_adjust->value = win->m_oldPos; gtk_signal_disconnect_by_func( GTK_OBJECT (win->m_adjust), (GtkSignalFunc) gtk_spinbutt_callback, (gpointer) win ); gtk_signal_emit_by_name( GTK_OBJECT(win->m_adjust), "value_changed" ); gtk_signal_connect( GTK_OBJECT (win->m_adjust), "value_changed", (GtkSignalFunc) gtk_spinbutt_callback, (gpointer) win ); return; } win->m_oldPos = win->m_adjust->value; /* always send a thumbtrack event */ if (command != wxEVT_SCROLL_THUMBTRACK) { command = wxEVT_SCROLL_THUMBTRACK; wxSpinEvent event2( command, win->GetId()); event2.SetPosition( value ); event2.SetEventObject( win ); win->HandleWindowEvent( event2 ); } }
/* Container method */ static void gtk_form_remove(GtkContainer *container, GtkWidget *widget) { GList *tmp_list; GtkForm *form; GtkFormChild *child = NULL; /* init for gcc */ g_return_if_fail(GTK_IS_FORM(container)); form = GTK_FORM(container); tmp_list = form->children; while (tmp_list) { child = tmp_list->data; if (child->widget == widget) break; tmp_list = tmp_list->next; } if (tmp_list) { if (child->window) { gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), GTK_SIGNAL_FUNC(>k_form_child_map), child); gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), GTK_SIGNAL_FUNC(>k_form_child_unmap), child); /* FIXME: This will cause problems for reparenting NO_WINDOW * widgets out of a GtkForm */ gdk_window_set_user_data(child->window, NULL); gdk_window_destroy(child->window); } gtk_widget_unparent(widget); form->children = g_list_remove_link(form->children, tmp_list); g_list_free_1(tmp_list); g_free(child); } }
void shutdown_toggled(void) { if (getuid() != 0) { gtk_signal_disconnect_by_func(GTK_OBJECT(WID(checkbutton_shutdown)), GTK_SIGNAL_FUNC(shutdown_toggled), NULL); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(WID(checkbutton_shutdown)), false); gtk_signal_connect(GTK_OBJECT(WID(checkbutton_shutdown)), "toggled", GTK_SIGNAL_FUNC(shutdown_toggled), NULL); GUI_Error_HIG(QT_TR_NOOP("Privileges Required"), QT_TR_NOOP( "Root privileges are required to perform this operation.")); } }
void wxRadioBox::GtkDisableEvents() { wxList::compatibility_iterator node = m_boxes.GetFirst(); while (node) { gtk_signal_disconnect_by_func( GTK_OBJECT(node->GetData()), GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this ); node = node->GetNext(); } }
static void gtk_form_unrealize(GtkWidget *widget) { GList *tmp_list; GtkForm *form; g_return_if_fail(GTK_IS_FORM(widget)); form = GTK_FORM(widget); tmp_list = form->children; gdk_window_set_user_data(form->bin_window, NULL); gdk_window_destroy(form->bin_window); form->bin_window = NULL; while (tmp_list) { GtkFormChild *child = tmp_list->data; if (child->window != NULL) { gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), GTK_SIGNAL_FUNC(gtk_form_child_map), child); gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), GTK_SIGNAL_FUNC(gtk_form_child_unmap), child); gdk_window_set_user_data(child->window, NULL); gdk_window_destroy(child->window); child->window = NULL; } tmp_list = tmp_list->next; } if (GTK_WIDGET_CLASS (parent_class)->unrealize) (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); }
static void confirm_no_clicked (GtkWidget *widget, TCONFIRM *confirm_t) { if (confirm_t) { confirm_t->yes_no = FALSE; gtk_signal_disconnect_by_func (GTK_OBJECT (confirm_t->mainwnd), GTK_SIGNAL_FUNC (gtk_main_quit), NULL); gtk_main_quit (); gtk_widget_destroy (confirm_t->mainwnd); } }
static void driverchooser_cancel_clicked (GtkWidget *widget, TDRIVERCHOOSER *choose_t) { if (choose_t) { choose_t->driverlist = NULL; choose_t->driver = NULL; gtk_signal_disconnect_by_func (GTK_OBJECT (choose_t->mainwnd), GTK_SIGNAL_FUNC (gtk_main_quit), NULL); gtk_main_quit (); gtk_widget_destroy (choose_t->mainwnd); } }
static void connectionpool_cancel_clicked (GtkWidget *widget, TCONNECTIONPOOLING *connectionpool_t) { if (connectionpool_t) { connectionpool_t->changed = FALSE; gtk_signal_disconnect_by_func (GTK_OBJECT (connectionpool_t->mainwnd), GTK_SIGNAL_FUNC (gtk_main_quit), NULL); gtk_main_quit (); gtk_widget_destroy (connectionpool_t->mainwnd); } }
static void translatorchooser_cancel_clicked (GtkWidget *widget, TTRANSLATORCHOOSER *choose_t) { if (choose_t) { choose_t->translatorlist = NULL; gtk_signal_disconnect_by_func (GTK_OBJECT (choose_t->mainwnd), GTK_SIGNAL_FUNC (gtk_main_quit), NULL); gtk_main_quit (); gtk_widget_destroy (choose_t->mainwnd); } }
static void login_cancel_clicked (GtkWidget *widget, TLOGIN *log_t) { if (log_t) { log_t->user = log_t->pwd = NULL; log_t->username = log_t->password = NULL; log_t->ok = FALSE; gtk_signal_disconnect_by_func (GTK_OBJECT (log_t->mainwnd), GTK_SIGNAL_FUNC (gtk_main_quit), NULL); gtk_main_quit (); gtk_widget_destroy (log_t->mainwnd); } }
static void gtk_combo_select_child_callback( GtkList *WXUNUSED(list), GtkWidget *WXUNUSED(widget), wxComboBox *combo ) { if (g_isIdle) wxapp_install_idle_handler(); if (!combo->m_hasVMT) return; if (g_blockEventsOnDrag) return; int curSelection = combo->GetCurrentSelection(); if (combo->m_prevSelection == curSelection) return; GtkWidget *list = GTK_COMBO(combo->m_widget)->list; gtk_list_unselect_item( GTK_LIST(list), combo->m_prevSelection ); combo->m_prevSelection = curSelection; // Quickly set the value of the combo box // as GTK+ does that only AFTER the event // is sent. gtk_signal_disconnect_by_func( GTK_OBJECT(GTK_COMBO(combo->GetHandle())->entry), GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)combo ); combo->SetValue( combo->GetStringSelection() ); gtk_signal_connect_after( GTK_OBJECT(GTK_COMBO(combo->GetHandle())->entry), "changed", GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)combo ); // throw a SELECTED event only if the combobox popup is hidden (wxID_NONE) // because when combobox popup is shown, gtk_combo_select_child_callback is // called each times the mouse is over an item with a pressed button so a lot // of SELECTED event could be generated if the user keep the mouse button down // and select other items ... if (g_SelectionBeforePopup == wxID_NONE) { wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, combo->GetId() ); event.SetInt( curSelection ); event.SetString( combo->GetStringSelection() ); event.SetEventObject( combo ); combo->GetEventHandler()->ProcessEvent( event ); // for consistency with the other ports, don't generate text update // events while the user is browsing the combobox neither wxCommandEvent event2( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() ); event2.SetString( combo->GetValue() ); event2.SetEventObject( combo ); combo->GetEventHandler()->ProcessEvent( event2 ); } }
static void gensetup_cancel_clicked(GtkWidget* widget, TGENSETUP *gensetup_t) { if (gensetup_t) { gensetup_t->connstr = (LPSTR) -1L; gensetup_t->dsn_entry = NULL; gensetup_t->key_list = NULL; gtk_signal_disconnect_by_func (GTK_OBJECT (gensetup_t->mainwnd), GTK_SIGNAL_FUNC (gtk_main_quit), NULL); gtk_main_quit (); gtk_widget_destroy (gensetup_t->mainwnd); } }
static void fdriverchooser_finish_clicked (GtkWidget *widget, TFDRIVERCHOOSER *choose_t) { char *szDriver; char *dsn; char buff[1024]; if (choose_t) { if (GTK_CLIST (choose_t->driverlist)->selection != NULL) { gtk_clist_get_text (GTK_CLIST (choose_t->driverlist), GPOINTER_TO_INT (GTK_CLIST (choose_t->driverlist)->selection-> data), 0, &szDriver); choose_t->driver = dm_SQL_A2W(szDriver, SQL_NTS); } else choose_t->driver = NULL; dsn = gtk_entry_get_text(choose_t->dsn_entry); if (strchr(dsn, '/') != NULL) snprintf(buff, sizeof(buff), "%s", dsn); else snprintf(buff, sizeof(buff), "%s/%s", choose_t->curr_dir, dsn); choose_t->dsn = strdup(buff); choose_t->driverlist = NULL; choose_t->dsn_entry = NULL; choose_t->b_back = NULL; choose_t->b_continue = NULL; choose_t->mess_entry = NULL; choose_t->tab_panel = NULL; choose_t->browse_sel = NULL; choose_t->ok = (choose_t->driver ? TRUE : FALSE); gtk_signal_disconnect_by_func (GTK_OBJECT (choose_t->mainwnd), GTK_SIGNAL_FUNC (gtk_main_quit), NULL); gtk_main_quit (); gtk_widget_destroy (choose_t->mainwnd); } }
void change_priority(void) { #ifndef __WIN32 if (getuid() != 0) { gtk_signal_disconnect_by_func(GTK_OBJECT(WID(combobox_priority)), GTK_SIGNAL_FUNC(change_priority), NULL); gtk_combo_box_set_active(GTK_COMBO_BOX(WID(combobox_priority)), 2); gtk_signal_connect(GTK_OBJECT(WID(combobox_priority)), "changed", GTK_SIGNAL_FUNC(change_priority), NULL); GUI_Error_HIG(QT_TR_NOOP("Privileges Required"), QT_TR_NOOP( "Root privileges are required to perform this operation.")); return; } #endif uint32_t priorityLevel; priorityLevel = gtk_combo_box_get_active(GTK_COMBO_BOX(WID(combobox_priority))); setpriority(PRIO_PROCESS, 0, ADM_getNiceValue(priorityLevel)); }
static void fdriverchooser_cancel_clicked (GtkWidget *widget, TFDRIVERCHOOSER *choose_t) { if (choose_t) { choose_t->driverlist = NULL; choose_t->driver = NULL; choose_t->ok = FALSE; choose_t->driverlist = NULL; choose_t->dsn_entry = NULL; choose_t->b_back = NULL; choose_t->b_continue = NULL; choose_t->mess_entry = NULL; choose_t->tab_panel = NULL; choose_t->browse_sel = NULL; gtk_signal_disconnect_by_func (GTK_OBJECT (choose_t->mainwnd), GTK_SIGNAL_FUNC (gtk_main_quit), NULL); gtk_main_quit (); gtk_widget_destroy (choose_t->mainwnd); } }
void lcrt_terminal_set_connected_status(struct lcrt_terminal *lterminal) { struct lcrt_window *lwindow = lterminal->parent->parent; debug_print("Login success\n"); lterminal->connected =TRUE; debug_where(); lcrt_terminal_set_status(lterminal, NULL, LCRT_TERMINAL_CONNECTED); if (lterminal->signal_connected) { gtk_signal_disconnect_by_func(GTK_OBJECT(lterminal->terminal), G_CALLBACK(lcrt_terminal_on_key_press_event), lterminal); lterminal->signal_connected = FALSE; } gtk_window_set_focus(GTK_WINDOW(lwindow->window), GTK_WIDGET(lterminal->terminal)); if (lterminal->save_passwd) { lcrt_user_save_one(&lwindow->u_config, lwindow->current_user); } if (strlen(lterminal->user->command) != 0) { vte_terminal_feed_child(lterminal->terminal, lterminal->user->command, strlen(lterminal->user->command)); vte_terminal_feed_child(lterminal->terminal, "\n", 1); } }