Ejemplo n.º 1
0
static void
editlist_gui_row_selected (GtkWidget * clist, gint row, gint column,
									GdkEventButton * even, gpointer none)
{
	char *name, *cmd;

	row = gtkutil_clist_selection (editlist_gui_list);
	if (row != -1)
	{
		gtk_clist_get_text (GTK_CLIST (clist), row, 0, &name);
		gtk_clist_get_text (GTK_CLIST (clist), row, 1, &cmd);

		name = strdup (name);
		cmd = strdup (cmd);

		gtk_entry_set_text (GTK_ENTRY (editlist_gui_entry_name), name);
		gtk_entry_set_text (GTK_ENTRY (editlist_gui_entry_cmd), cmd);

		free (name);
		free (cmd);
	} else
	{
		editlist_gui_row_unselected (0, 0, 0, 0, 0);
	}
}
Ejemplo n.º 2
0
/*
 * User selected a row
 */
static void select_row_cb(GtkCList *item, gint row, gint column,
             GdkEventButton *event, Window *restore)
{
   char *file;
   char *marked = NULL;
   /* Column non-negative => double click */
   if (column >= 0) {
      gtk_clist_unselect_row(item, row, column);
      /* Double click on column 0 means to mark or unmark */
      if (column == 0) {
         gtk_clist_get_text(restore->list, row, CHECK_COLUMN, &marked);
         Dmsg1(200, "Marked=%s\n", marked);
         if (!marked || strcmp(marked, "x") != 0) {
            mark_row(row, true);
         } else {
            mark_row(row, false);
         }
      } else {
      /* Double clicking on directory means to move to it */
         int len;
         gtk_clist_get_text(item, row, FILE_COLUMN, &file);
         len = strlen(file);
         if (len > 0 && file[len-1] == '/') {
            /* Change to new directory */
            pm_strcpy(restore->path, restore->fname);
            if (*file == '*') {
               Mmsg(restore->fname, "%s%s", restore->path, file+1);
            } else {
               Mmsg(restore->fname, "%s%s", restore->path, file);
            }
            FillDirectory(restore->fname, restore);
         }
      }
   }
}
Ejemplo n.º 3
0
void
on_clist_satdb_select_row              (GtkCList        *clist,
                                        gint             row,
                                        gint             column,
                                        GdkEvent        *event,
                                        gpointer         user_data)
{
  GtkWidget *widget;
  char *sat, *mode, *uplink, *downlink, *beacon;

  selectedrow = row;

  gtk_clist_get_text(clist, row, 0, &sat);
  gtk_clist_get_text(clist, row, 1, &mode);
  gtk_clist_get_text(clist, row, 2, &uplink);
  gtk_clist_get_text(clist, row, 3, &downlink);
  gtk_clist_get_text(clist, row, 4, &beacon);
  widget = lookup_widget( dialog_dbedit, "tx_dbsat" );
  gtk_entry_set_text(GTK_ENTRY(widget), sat);
  widget = lookup_widget( dialog_dbedit, "tx_dbmode" );
  gtk_entry_set_text(GTK_ENTRY(widget), mode);
  widget = lookup_widget( dialog_dbedit, "tx_dbuplink" );
  gtk_entry_set_text(GTK_ENTRY(widget), uplink);
  widget = lookup_widget( dialog_dbedit, "tx_dbdownlink" );
  gtk_entry_set_text(GTK_ENTRY(widget), downlink);
  widget = lookup_widget( dialog_dbedit, "tx_dbbeacon" );
  gtk_entry_set_text(GTK_ENTRY(widget), beacon);
}
Ejemplo n.º 4
0
static void cb_clist_selection(GtkWidget      *clist,
                               gint           row,
                               gint           column,
                               GdkEventButton *event,
                               gpointer       data)
{
   char fname[1000];
   char *gtk_str;

   clist_row_selected = row;

   if (column == INST_SDCARD_COLUMN) {
      /* Toggle display of SDCARD pixmap */
      if (gtk_clist_get_text(GTK_CLIST(clist), row, column, NULL)) {
         GdkPixmap *pixmap;
         GdkBitmap *mask;
         get_pixmaps(clist, PIXMAP_SDCARD, &pixmap, &mask);
         gtk_clist_set_pixmap(GTK_CLIST(clist), row, column, pixmap, mask);
         
         gtk_clist_get_text(GTK_CLIST(clist), row, INST_FNAME_COLUMN, &gtk_str); 
         fname[0] = '\001';
         g_strlcpy(&fname[1], gtk_str, sizeof(fname)-1);
         install_modify_line(row, fname);

      } else {
         gtk_clist_set_text(GTK_CLIST(clist), row, column, "");
         gtk_clist_get_text(GTK_CLIST(clist), row, INST_FNAME_COLUMN, &gtk_str); 
         g_strlcpy(&fname[0], gtk_str, sizeof(fname));
         install_modify_line(row, fname);
      }
   }

   return;
}
Ejemplo n.º 5
0
static void apply_config(void) {
  int i;
  char *field = NULL;

  free_stations();
  nstations = gui_station_count;
  stations = malloc(sizeof(struct station) * nstations);

  for (i = 0; i < nstations; i++) {
    gtk_clist_get_text(GTK_CLIST(gui_station_list), i, 0, &field);
    stations[i].station_name = strdup(field);

    gtk_clist_get_text(GTK_CLIST(gui_station_list), i, 1, &field);
    stations[i].freq = atof(field);
  }

  mutetime = gtk_spin_button_get_value_as_float(GTK_SPIN_BUTTON(gui_mutetime_entry));

  set_text_freq(radio_getfreq()); /* reset the frequency display */

  attempt_reopen =
    gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gui_reopen_toggle));

  close_atexit =
    gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gui_close_toggle));
  /* recreate the frequency menu */
  create_freq_menu();
}
Ejemplo n.º 6
0
void selection_made( GtkWidget      *clist,
                     gint            row,
                     gint            column,
		     GdkEventButton *event,
                     gpointer        data )
{
    gchar *ip, *hops, *gw, *dev;
    const gchar text[100];
    /* Get the text that is stored in the selected row and column
     * which was clicked in. We will receive it as a pointer in the
     * argument text.
     */
    gtk_clist_get_text(GTK_CLIST(clist), row, 0, &ip);
    gtk_clist_get_text(GTK_CLIST(clist), row, 1, &gw);
    gtk_clist_get_text(GTK_CLIST(clist), row, 2, &hops);
    gtk_clist_get_text(GTK_CLIST(clist), row, 3, &dev);

    /* Just prints some information about the selected row */
    sprintf((char *)&text[0], "IP:%s\nGATEWAY:%s\nHOPCOUNT:%s\nINTERFACE:%s\n",
	    ip, gw, hops, dev);

    //gtk_text_buffer_set_text (textBuffer, text, -1);

    //gtk_text_view_set_buffer((GtkTextView *)text1, textBuffer);

    //gtk_widget_show (text1);


    return;
}
Ejemplo n.º 7
0
static gboolean search_for_entry(GtkWidget *widget, GdkEventKey *event, dialog_generic_t *dptr)
{
    GtkCList *clist = GTK_CLIST(widget);
    int z, wrapped;

    if(event->keyval == GDK_Return) {
	selection_made_common(widget, clist->focus_row, dptr);
    }

    if(!isprint(event->string[0])) {
	strcpy(search_target, "");
	search_row = clist->focus_row;
	return 0;
    }

    if(event->time - search_time > SEARCH_RESET_TIME) {
	strcpy(search_target, "");
	search_row = clist->focus_row;
    }

    search_time = event->time;
    if(strcmp(event->string, " ") == 0) {
	char *text;
	search_row = search_row + 1;
	if(!gtk_clist_get_text(clist, search_row, 0, &text))
	    search_row = 0;
	printf("next search: %d\n", search_row);
    } else {
	strcat(search_target, event->string);
    }
    
    for(z = search_row, wrapped=0; z != search_row || !wrapped; z ++) {
	char *text;

	printf("search: %d (wrapped=%d)\n", z, wrapped);
	if(!gtk_clist_get_text(clist, z, 0, &text)) {
	    if(wrapped) break; // wrapped second time (why?)
	    z = 0;
	    wrapped = 1; 
	}
	
	if(strstr(text, search_target)) {
	    double pos = (z+.5) / (clist->rows-1);
	    if(pos > 1) pos = 1;
	    
	    GTK_CLIST_GET_CLASS(clist)->scroll_vertical(clist, GTK_SCROLL_JUMP, pos);
	    gtk_clist_select_row(clist, z, 0);
	    search_row = z;
	    return 1;
	}
    }
    return 0;
}
Ejemplo n.º 8
0
gint trig_list_select_row (GtkWidget *wid, gint row, gint col, GdkEventButton *event, gpointer data)
{
	char *match, *command;
	trig_current_row = row;
	gtk_clist_get_text(GTK_CLIST(trig_list), row, 0, &match);
	gtk_clist_get_text(GTK_CLIST(trig_list), row, 1, &command);

	gtk_entry_set_text(GTK_ENTRY(trig_match_entry), match);
	gtk_entry_set_text(GTK_ENTRY(trig_command_entry), command);

	return TRUE;
}
Ejemplo n.º 9
0
void gui_edit_station(GtkButton *button, gpointer *userdata) {
  gchar *field = NULL;
  gfloat freq;
  close_station_editor();
  create_station_editor(FALSE);
  if (!gtk_clist_get_text(GTK_CLIST(gui_station_list), 
        gui_station_selected, 0, &field)) return;

  gtk_entry_set_text(GTK_ENTRY(gui_station_name_input), field);

  gtk_clist_get_text(GTK_CLIST(gui_station_list), gui_station_selected, 1, &field);
  freq = atof(field);
  gtk_spin_button_set_value(GTK_SPIN_BUTTON(gui_freq_input), freq);
  gtk_widget_show_all(gui_station_dialog);
}
Ejemplo n.º 10
0
static void
goto_bookmark (GtkWidget * menu_item, gchar *value)
{
	GList *tmp;
	gint i;
	gchar *file;

	for(tmp = cfg.bookmarks; tmp != NULL; tmp = tmp->next)
	{
		Bookmarks *bk = tmp->data;
		if(!strcmp(value, bk->mark))
		{
			change_dir(curr_view, bk->dir);
			gtk_clist_freeze(GTK_CLIST(curr_view->clist));
			for(i = 0; i < GTK_CLIST(curr_view->clist)->rows; i++)
			{
				gtk_clist_get_text(GTK_CLIST(curr_view->clist), i, 0, &file);

				if(!strcmp(bk->file, file))
				{
					focus_on_row(curr_view, i);
					gtk_clist_thaw(GTK_CLIST(curr_view->clist));
					return;
				}
			}
			focus_on_row(curr_view, 0);
			gtk_clist_thaw(GTK_CLIST(curr_view->clist));
			return;
		}
	}
	status_bar_message("Mark not found");
	return;
}
Ejemplo n.º 11
0
static void selection_made_common(GtkWidget *clist, gint row, dialog_generic_t *dptr) {
    gint n, listnum;
    gchar *name;
    int rv, chan_num;

    scope_vert_t *vert;
    /* If we get here, it should be a valid selection */
    vert = &(ctrl_usr->vert);
    chan_num = *((int *)(dptr->app_data));
    /* figure out which notebook tab it was */
    listnum = -1;
    for (n = 0; n < 3; n++) {
	if (clist == vert->lists[n]) {
	    listnum = n;
	}
    }
    /* Get the text from the list */
    gtk_clist_get_text(GTK_CLIST(clist), row, 0, &name);
    /* try to set up the new source */
    rv = set_channel_source(chan_num, listnum, name);
    if ( rv == 0 ) {
	/* set return value of dialog to indicate success */
	dptr->retval = 1;
    } else {
	/* new source invalid, return as if user hit cancel */
	dptr->retval = 2;
    }
    /* destroy window to cause dialog_generic_destroyed() to be called */
    gtk_widget_destroy(dptr->window);
    return;
}
Ejemplo n.º 12
0
void lzaktaxi_selection_row( GtkWidget *clist,gint row,gint column,GdkEventButton *event,
class lzaktaxi_data *data)
{
gchar *text;
//SQL_str rowsql;

gtk_clist_get_text(GTK_CLIST(clist), row, column, &text);

data->rowv=(SQL_str)gtk_clist_get_row_data(GTK_CLIST(clist), row);
data->metkavz=1;


//g_print("selection_row-You selected row %d. More specifically you clicked in "
//            "column %d, and the text in this cell is %s Shet=%s\n\n",
//	    row, column, text,data->rowv[0]);
gtk_widget_set_sensitive(GTK_WIDGET(data->knopka[SFK2]),TRUE);//доступна
gtk_widget_set_sensitive(GTK_WIDGET(data->knopka[FK3]),TRUE);//доступна
gtk_widget_set_sensitive(GTK_WIDGET(data->knopka[FK6]),TRUE);//доступна

if(event != NULL)
 if(event->type == GDK_2BUTTON_PRESS) //Двойное нажатие
  gtk_signal_emit_by_name(GTK_OBJECT(data->knopka[SFK2]),"clicked"); 


}
Ejemplo n.º 13
0
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);
    }
}
Ejemplo n.º 14
0
/* If we come here, then the user has selected a row in the list. */
void selection_made( GtkWidget      *clist,
                     gint            row,
                     gint            column,
                     GdkEventButton *event,
                     gpointer        data )
{
    gchar *text;

    struct SongDBEntry * e;

    /* Get the current playlist entry */
    e = SONGDB_GetEntryID(row);
    if(e)
    {
        PLAYER_Load(0,e);
        PLAYER_Play(0);
    }

    /* Get the text that is stored in the selected row and column
     * which was clicked in. We will receive it as a pointer in the
     * argument text.
     */
    gtk_clist_get_text(GTK_CLIST(clist), row, column, &text);

    /* Just prints some information about the selected row */
    g_print("You selected row %d. More specifically you clicked in "
            "column %d, and the text in this cell is %s\n\n",
            row, column, text);

    return;
}
Ejemplo n.º 15
0
static gboolean fs_fsFNameList_event( GtkWidget * widget,
                                      GdkEvent * event,
                                      gpointer user_data )
{
  GdkEventButton *bevent;
  gint row, col;

  (void) user_data;

  bevent = (GdkEventButton *) event;

  if ( event->type == GDK_BUTTON_RELEASE && bevent->button == 2 )
  {
    if ( gtk_clist_get_selection_info( GTK_CLIST( widget ), bevent->x, bevent->y, &row, &col ) )
    {
      gtk_clist_get_text( GTK_CLIST( widget ), row, 1, &fsSelectedFile );
      g_free( fsSelectedFileUtf8 );
      fsSelectedFileUtf8 = g_filename_from_utf8( fsSelectedFile, -1, NULL, NULL, NULL );
      if ( fsSelectedFileUtf8 ) fsSelectedFile = fsSelectedFileUtf8;
      gtk_button_released( GTK_BUTTON( fsOk ) );
      return TRUE;
    }
  }

  return FALSE;
}
Ejemplo n.º 16
0
static void OkSelectContactDialog(GtkWidget * widget, SelectContactData * data)
{
	GList *sel;
	PhonebookEntry *pbEntry;
	gchar *key;

	if ((sel = GTK_CLIST(data->clist)->selection) != NULL) {
		D_SpeedDial *d = (D_SpeedDial *) g_malloc(sizeof(D_SpeedDial));

		gtk_clist_freeze(GTK_CLIST(clist));

		pbEntry = gtk_clist_get_row_data(GTK_CLIST(data->clist),
						 GPOINTER_TO_INT(sel->data));

		gtk_clist_get_text(GTK_CLIST(clist), selectedKey, 0, &key);

		gtk_clist_set_text(GTK_CLIST(clist), selectedKey, 1, pbEntry->entry.name);
		gtk_clist_set_text(GTK_CLIST(clist), selectedKey, 2, pbEntry->entry.number);

		d->entry.number = *key - '0';
		d->entry.memory_type = pbEntry->entry.memory_type + 2;
		d->entry.location = pbEntry->entry.location;

		gtk_clist_set_row_data_full(GTK_CLIST(clist), selectedKey,
					    (gpointer) d, DestroyCListData);

		gtk_clist_sort(GTK_CLIST(clist));
		gtk_clist_thaw(GTK_CLIST(clist));
	}

	gtk_widget_destroy(GTK_WIDGET(data->clist));
	gtk_widget_destroy(GTK_WIDGET(data->clistScrolledWindow));
	gtk_widget_destroy(GTK_WIDGET(data->dialog));
}
Ejemplo n.º 17
0
gchar *widget_table_envvar_all_construct(variable *var)
{
	gchar            *line;
	gchar            *string;
	gchar            *text;
	gchar            *value;
	gint              column = 0;
	gint              retval;
	gint              row = 0;

#ifdef DEBUG_TRANSITS
	fprintf(stderr, "%s(): Entering.\n", __func__);
#endif

#if !GTK_CHECK_VERSION(3,0,0)	/* gtk3: Deprecated in gtk2 and now gone */
	/* Which column should we export */
	if (var->widget_tag_attr) {
		/* Get exported-column */
		if ((value = get_tag_attribute(var->widget_tag_attr, "exported-column")))
			column = atoi(value);
	}
	/* Where's the GtkCList row count? It's not such a problem as
	 * gtk_clist_get_text() returns 0 if it's not available at which
	 * point we'll stop */
	line = g_strdup_printf("%s_ALL=\"", var->Name);
	retval = gtk_clist_get_text(GTK_CLIST(var->Widget), row, column, &string);
	while (retval) {
		if (row == 0) {
			text = g_strconcat(line, "'", string, "'", NULL);
		} else {
			text = g_strconcat(line, " '", string, "'", NULL);
		}
		g_free(line);
		line = text;
		row++;
		retval = gtk_clist_get_text(GTK_CLIST(var->Widget), row, column, &string);
	}
	string = g_strconcat(line, "\"\n", NULL);
	g_free(line);
#endif

#ifdef DEBUG_TRANSITS
	fprintf(stderr, "%s(): Exiting.\n", __func__);
#endif

	return string;
}
Ejemplo n.º 18
0
static void fs_fsFNameList_select_row( GtkWidget * widget, gint row, gint column,
                                       GdkEventButton *bevent, gpointer user_data)
{
 gtk_clist_get_text( GTK_CLIST(widget ),row,1,&fsSelectedFile );
 g_free( fsSelectedFileUtf8 );
 fsSelectedFileUtf8 = g_filename_from_utf8( fsSelectedFile, -1, NULL, NULL, NULL );
 if ( fsSelectedFileUtf8 ) fsSelectedFile = fsSelectedFileUtf8;
 if( bevent && bevent->type == GDK_BUTTON_PRESS )  gtk_button_released( GTK_BUTTON( fsOk ) );
}
Ejemplo n.º 19
0
static void
playlist_op(GtkWidget *widget, guint data)
{
    int		i;
    const gchar	*filename[2];
    gchar	action, *rowdata, fname[BUFSIZ], *tmp;
    FILE	*plfp;

    gtk_widget_hide(plfilesel);

    if(!data)
	return;

    action = GPOINTER_TO_INT(gtk_object_get_user_data(GTK_OBJECT(plfilesel)));
    filename[0] = gtk_file_selection_get_filename(GTK_FILE_SELECTION(plfilesel));

    if(action == 'l') {
	if((plfp = fopen(filename[0], "r")) == NULL) {
	    g_error("Can't open %s for reading.", filename[0]);
	    return;
	}
	while(fgets(fname, BUFSIZ, plfp) != NULL) {
            gchar *filename[2];
	    if(fname[strlen(fname) - 1] == '\n')
		fname[strlen(fname) - 1] = '\0';
	    filename[0] = fname;
	    filename[1] = NULL;
	    gtk_clist_append(GTK_CLIST(clist), filename);
	}
	fclose(plfp);
	gtk_clist_columns_autosize(GTK_CLIST(clist));
    }
    else if(action == 's') {
	if((plfp = fopen(filename[0], "w")) == NULL) {
	    g_error("Can't open %s for writing.", filename[0]);
	    return;
	}
	for(i = 0; i < GTK_CLIST(clist)->rows; i++) {
	    gtk_clist_get_text(GTK_CLIST(clist), i, 0, &rowdata);
	    /* Make sure we have an absolute path. */
	    if(*rowdata != '/') {
		tmp = g_get_current_dir();
		rowdata = g_strconcat(tmp, "/", rowdata, NULL);
		fprintf(plfp, "%s\n", rowdata);
		g_free(rowdata);
		g_free(tmp);
	    }
	    else {
		fprintf(plfp, "%s\n", rowdata);
	    }
	}
	fclose(plfp);
    }
    else {
	g_error("Invalid playlist action!.");
    }
} /* playlist_op */
Ejemplo n.º 20
0
static void
gensetup_list_select(GtkWidget* widget, gint row, gint column, GdkEvent *event, TGENSETUP *gensetup_t)
{
  char *szKey, *szValue;

  if (gensetup_t && GTK_CLIST (gensetup_t->key_list)->selection != NULL)
    {
      gtk_clist_get_text (GTK_CLIST (gensetup_t->key_list),
	  GPOINTER_TO_INT (GTK_CLIST (gensetup_t->key_list)->selection->data),
	  0, &szKey);
      gtk_clist_get_text (GTK_CLIST (gensetup_t->key_list),
	  GPOINTER_TO_INT (GTK_CLIST (gensetup_t->key_list)->selection->data),
	  1, &szValue);
      gtk_entry_set_text (GTK_ENTRY (gensetup_t->key_entry), szKey);
      gtk_entry_set_text (GTK_ENTRY (gensetup_t->value_entry), szValue);
      gtk_widget_set_sensitive (gensetup_t->bupdate, TRUE);
    }
}
Ejemplo n.º 21
0
void SelectRowSignal( GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer user_data)
{
	if ( gtk_clist_get_text( GTK_CLIST(SectionsList), row, 0, (gchar **)&pNameSectionSelected ) )
	{
		RowSectionSelected = row;
		SectionSelected( pNameSectionSelected );
		EditorButtonsAccordingSectionType( );
		UpdateVScrollBar( );
	}
}
Ejemplo n.º 22
0
static void fs_fsFNameList_select_row( GtkCList * clist, gint row, gint column,
                                       GdkEvent * event, gpointer user_data)
{
 fsCurrFNameListSelected = row;
 gtk_clist_get_text( clist,row,1,&fsSelectedFile );
 g_free( fsSelectedFileUtf8 );
 fsSelectedFileUtf8 = g_filename_from_utf8( fsSelectedFile, -1, NULL, NULL, NULL );
 if ( fsSelectedFileUtf8 ) fsSelectedFile = fsSelectedFileUtf8;
 if( event && event->type == GDK_BUTTON_PRESS )  gtk_button_released( GTK_BUTTON( fsOk ) );
}
Ejemplo n.º 23
0
void select_minilist_item(GtkWidget * list, gint row, gint column,
			  GdkEventButton * event, gpointer data)
{
    struct slist_gui *the_gui = (struct slist_gui *) data;
    gchar *to_change;
    the_gui->chosen_row = row;

    gtk_clist_get_text(GTK_CLIST(the_gui->list), row, 0, &to_change);
    gtk_entry_set_text(GTK_ENTRY(the_gui->entry), to_change);
    gtk_entry_select_region(GTK_ENTRY(the_gui->entry), 0, -1);
}
Ejemplo n.º 24
0
static void 
select_row(GtkCList *clist, int row, int column, GdkEventButton *event, struct data_window *win)
{
	int i;
	if (win->callback) {
		char *cols[20];
		for (i=0;i<20;i++) {
			gtk_clist_get_text(clist, row, i, &cols[i]);
		}	
		win->callback(win, cols);
	}
}
Ejemplo n.º 25
0
static void
module_glist_unload (GtkWidget * wid, struct session *sess)
{
	int row;
	char *modname;

	row = gtkutil_clist_selection (modclist);
	if (row == -1)
		return;
	gtk_clist_get_text (GTK_CLIST (modclist), row, 0, &modname);
	module_unload (modname, sess);
}
Ejemplo n.º 26
0
static void
notify_remove_clicked (GtkWidget * igad)
{
	int row;
	char *name;

	row = gtkutil_clist_selection (notify_guilist);
	if (row != -1)
	{
		gtk_clist_get_text (GTK_CLIST (notify_guilist), row, 0, &name);
		notify_deluser (name);
	}
}
Ejemplo n.º 27
0
    gint Meaning::_wordclick
    (GtkWidget* list, gint row, gint col, GdkEventButton *e, gpointer data)
    throw(std::bad_alloc)
    {
        Meaning *m = static_cast<Meaning*>(data);
        m->d_display._handleSelection(GTK_WIDGET(list));

        char* text;    
        gtk_clist_get_text(GTK_CLIST(list), row, 0, &text);
        m->d_display._handleClick((e->type == GDK_2BUTTON_PRESS), text);

        return 0;
    }
Ejemplo n.º 28
0
/* grava os contados da clist em um arquivo em disco */
void get_dados(GtkWidget *w, gpointer *p){
	gchar *text;
	char *contatos[LINHAS][COLUNAS];
	char *aux;
	int i = 0;

	while(i < LINHAS){
		text = "";
		gtk_clist_get_text(GTK_CLIST(p),i,0,&text);
		contatos[i][0] = (char *) text;
		gtk_clist_get_text(GTK_CLIST(p),i,1,&text);
		contatos[i][1] = (char *) text;
		
		if (contatos[i][0] == "" && contatos[i][1]== "" )
			break;

		i++;
	}

	FILE *file;
	file = fopen("file.txt","w");
	if(file == NULL){
		g_printf("\nFalha ao abrir o arquivo\n");
		exit(1);
	}
	else{
		i =0;
		while(i < LINHAS){
			fprintf(file,"%s %s",contatos[i][0],contatos[i][1]);
			fputs("\n",file);
			++i;
			if(contatos[i][0]=="")
				break;
		}	
	}

	fclose(file);
}
Ejemplo n.º 29
0
int gtkFindInCList (GtkWidget *list, char *item)
{
  gint j;
  gchar *tmpstr;

  for (j = 0; j < GTK_CLIST(list)->rows; j++)
  {
    gtk_clist_get_text(GTK_CLIST(list), j, 0, &tmpstr);

    if (!strcmp(tmpstr, item)) return j;
  }

  return -1;
}
Ejemplo n.º 30
0
char * 
search_gui_details_get_text(GtkWidget *widget)
{
	char *text = NULL;
	int row;

	g_return_val_if_fail(widget, NULL);

	row = clist_get_cursor_row(GTK_CLIST(widget));
	if (row >= 0 && gtk_clist_get_text(GTK_CLIST(widget), row, 1, &text)) {
		return g_strdup(text);
	} else {
		return NULL;
	}
}