/* something is going to be printed to screen, print our current netsplit message before it. */ static void sig_print_starting(void) { while (modes != NULL) { print_mode(modes->data); mode_destroy(modes->data); } }
static void msg_multi_mode(IRC_CHANNEL_REC *channel, const char *sender, const char *addr, const char *mode) { MODE_REC *rec; if (modes == NULL) signal_add("print starting", (SIGNAL_FUNC) sig_print_starting); rec = mode_find_channel(channel); if (rec != NULL && strcmp(rec->mode, mode) != 0) { /* different mode than last time, show and remove the old */ print_mode(rec); mode_destroy(rec); rec = NULL; } if (rec == NULL) { /* no previous mode, create new */ rec = g_new0(MODE_REC, 1); modes = g_slist_append(modes, rec); rec->channel = channel; rec->mode = g_strdup(mode); } rec->nicks = g_slist_append(rec->nicks, g_strdup(sender)); rec->last_mode = time(NULL); signal_stop(); }
/* something is going to be printed to screen, print our current netsplit message before it. */ static void sig_print_starting(void) { while (modes != NULL) { print_mode(modes->data); mode_destroy(modes->data); } signal_remove("print starting", sig_print_starting); }
static void combi_mode_destroy ( Mode *sw ) { CombiModePrivateData *pd = (CombiModePrivateData *) mode_get_private_data ( sw ); if ( pd != NULL ) { g_free ( pd->starts ); g_free ( pd->lengths ); // Cleanup switchers. for ( unsigned int i = 0; i < pd->num_switchers; i++ ) { mode_destroy ( pd->switchers[i] ); } g_free ( pd->switchers ); g_free ( pd ); mode_set_private_data ( sw, NULL ); } }
static void dmenu_finish ( RofiViewState *state, int retv ) { if ( retv == FALSE ) { rofi_set_return_code ( EXIT_FAILURE ); } else if ( retv >= 10 ) { rofi_set_return_code ( retv ); } else{ rofi_set_return_code ( EXIT_SUCCESS ); } rofi_view_set_active ( NULL ); rofi_view_free ( state ); mode_destroy ( &dmenu_mode ); }
void process_result ( RofiViewState *state ) { Mode *sw = state->sw; if ( sw != NULL ) { unsigned int selected_line = rofi_view_get_selected_line ( state );; MenuReturn mretv = rofi_view_get_return_value ( state ); char *input = g_strdup ( rofi_view_get_user_input ( state ) ); rofi_view_set_active ( NULL ); rofi_view_free ( state ); ModeMode retv = mode_result ( sw, mretv, &input, selected_line ); ModeMode mode = curr_switcher; // Find next enabled if ( retv == NEXT_DIALOG ) { mode = ( mode + 1 ) % num_modi; } else if ( retv == PREVIOUS_DIALOG ) { if ( mode == 0 ) { mode = num_modi - 1; } else { mode = ( mode - 1 ) % num_modi; } } else if ( retv == RELOAD_DIALOG ) { // do nothing. } else if ( retv < MODE_EXIT ) { mode = ( retv ) % num_modi; } else { mode = retv; } if ( mode != MODE_EXIT ) { /** * Load in the new mode. */ __run_switcher_internal ( mode, input ); g_free ( input ); return; } // Cleanup g_free ( input ); for ( unsigned int i = 0; i < num_modi; i++ ) { mode_destroy ( modi[i] ); } } }
static int sig_check_modes(void) { GSList *tmp, *next; if (modes == NULL) return 1; for (tmp = modes; tmp != NULL; tmp = next) { MODE_REC *rec = tmp->data; next = tmp->next; if (time(NULL)-rec->last_mode >= MODE_WAIT_TIME) { print_mode(rec); mode_destroy(rec); } } if (modes == NULL) signal_remove("print starting", (SIGNAL_FUNC) sig_print_starting); return 1; }
CELTCodec::~CELTCodec() { if (cmMode) mode_destroy(const_cast<CELTMode *>(cmMode)); }