Ejemplo n.º 1
0
static gint
fontsel_set_style_by_name (StyleSelect *select)
{
  FontFace *font_face = NULL;
  GtkCList *clist;
  gint      row;

  g_return_val_if_fail (select != NULL, FALSE);

  font_face = g_tree_lookup (select->family, select->style_name);

  if (font_face)
    {
      clist = g_object_get_data (G_OBJECT (select->fontsel), "style_list");
      row = gtk_clist_find_row_from_data (GTK_CLIST (clist), font_face);
      gtk_clist_select_row (GTK_CLIST (clist), row, 0);

      if ( !(gtk_clist_row_is_visible (clist, row) & GTK_VISIBILITY_FULL))
	gtk_clist_moveto (clist, row, 0, 0.0, 0.0);
    }

  g_free (select);

  return FALSE;
}
Ejemplo n.º 2
0
/*********************************************************************************************************
 * callbacks
 */
static void
callback_okClicked( GtkWidget *widget, gpointer data )
{
	char crc_code[200];

	gtk_widget_hide( g_RomPropDialog.dialog );
	gtk_grab_remove( g_RomPropDialog.dialog );

	/* save properties */
	strcpy( g_RomEntry->info.cComments, gtk_entry_get_text( GTK_ENTRY(g_RomPropDialog.commentsEntry) ) );

	/* save cache and ini */
	rombrowser_writeCache();
	if( !g_RomEntry->iniEntry )
	{
		sprintf( crc_code, "%08X-%08X-C%02X", sl(g_RomEntry->info.iCRC1), sl(g_RomEntry->info.iCRC2), g_RomEntry->info.cCountry );
		g_RomEntry->iniEntry = ini_search_by_CRC( crc_code );
	}
	if( g_RomEntry->iniEntry )
	{
		strcpy( g_RomEntry->iniEntry->comments, g_RomEntry->info.cComments );
		ini_updateFile(1);
	}

	// update rombrowser
	gtk_clist_set_text( GTK_CLIST(g_MainWindow.romCList), gtk_clist_find_row_from_data( GTK_CLIST(g_MainWindow.romCList), g_RomEntry ),
											3, g_RomEntry->info.cComments );
}
Ejemplo n.º 3
0
/**
 * Removes all references to the given node handle in the gui.
 */
void
nodes_gui_remove_node(const struct nid *node_id)
{
    GtkWidget *clist_nodes;
    gint row;

    clist_nodes = gui_main_window_lookup("clist_nodes");

    /*
     * Make sure node is remove from the "changed" hash table so
     * we don't try an update.
     */
    g_assert(NULL != hs_node_info_changed);
    g_assert(NULL != hs_node_flags_changed);

    remove_item(hs_node_info_changed, node_id);
    remove_item(hs_node_flags_changed, node_id);

	row = gtk_clist_find_row_from_data(GTK_CLIST(clist_nodes),
				deconstify_gpointer(node_id));
    if (row != -1) {
        gtk_clist_remove(GTK_CLIST(clist_nodes), row);
		nid_unref(node_id);
	} else {
        g_warning("%s(): no matching row found", G_STRFUNC);
	}
}
Ejemplo n.º 4
0
/* This updates the file list to show (and select) a particular node
 * entry. The directory tree is also updated appropriately */
void
filelist_show_entry( GNode *node )
{
	GNode *dnode;
	int row;

	/* Corresponding directory */
	if (NODE_IS_DIR(node))
		dnode = node;
	else
		dnode = node->parent;

	if (dnode != filelist_current_dnode) {
		/* Scroll directory tree to proper entry */
		dirtree_entry_show( dnode );
	}

	/* Scroll file list to proper entry */
	row = gtk_clist_find_row_from_data( GTK_CLIST(file_clist_w), node );
	if (row >= 0)
		gtk_clist_select_row( GTK_CLIST(file_clist_w), row, 0 );
	else
		gtk_clist_unselect_all( GTK_CLIST(file_clist_w) );
	gui_clist_moveto_row( file_clist_w, MAX(0, row), FILELIST_SCROLL_TIME );
}
Ejemplo n.º 5
0
gboolean gnc_query_list_item_in_list (GNCQueryList *list, gpointer item)
{
    g_return_val_if_fail(list, FALSE);
    g_return_val_if_fail(item, FALSE);
    g_return_val_if_fail(IS_GNC_QUERY_LIST(list), FALSE);

    return (gtk_clist_find_row_from_data(GTK_CLIST(list), item) != -1);
}
Ejemplo n.º 6
0
int remove_breakpoint_by_address( uint32 address )
{
	int row;

	row = gtk_clist_find_row_from_data( GTK_CLIST(clBreakpoints),(gpointer) address);
	if( row != -1 ) {
		remove_breakpoint_by_row( row );
	}
	return row;
}
Ejemplo n.º 7
0
void gnc_query_list_refresh_item (GNCQueryList *list, gpointer item)
{
    gint row;

    g_return_if_fail(list);
    g_return_if_fail(item);
    g_return_if_fail(IS_GNC_QUERY_LIST(list));

    row = gtk_clist_find_row_from_data(GTK_CLIST(list), item);
    if (row != -1)
        update_booleans (list, row);
}
Ejemplo n.º 8
0
int check_breakpoints( uint32 address )
{
	int i=0;
	
	while( i != nb_breakpoints )
	{
		if( bp_addresses[i]!=address )
			i++;
		else
			return gtk_clist_find_row_from_data( GTK_CLIST(clBreakpoints),(gpointer) address);
	}
	return -1;
}
static int mod_update(void)
{
	char *module= NULL;
	/* Update the mod stuff */
	if (GTK_CLIST(modules)->selection) {
		module= (char *)gtk_clist_get_row_data(GTK_CLIST(modules), (int) GTK_CLIST(modules)->selection->data);
	}
	gtk_clist_freeze(GTK_CLIST(modules));
	gtk_clist_clear(GTK_CLIST(modules));
	ast_update_module_list(add_mod, NULL);
	if (module)
		gtk_clist_select_row(GTK_CLIST(modules), gtk_clist_find_row_from_data(GTK_CLIST(modules), module), -1);
	gtk_clist_thaw(GTK_CLIST(modules));
	return 1;
}
Ejemplo n.º 10
0
void
gradient_select_delete_all (gradient_t *gradient)
{
  GradientSelect *gsp; 
  GSList         *list;
  gint            row;

  for (list = gradient_active_dialogs; list; list = g_slist_next (list))
    {
      gsp = (GradientSelect *) list->data;
      
      row = gtk_clist_find_row_from_data (GTK_CLIST (gsp->clist), gradient);
      if (row > -1)
	gtk_clist_remove (GTK_CLIST (gsp->clist), row);
    }
}
Ejemplo n.º 11
0
void
fe_dcc_update_recv (struct DCC *dcc)
{
	char pos[14], cps[14], perc[14], eta[14];
	gint row;
	int to_go;
	float per;

	if (!dccrwin.window)
		return;

	row =
		gtk_clist_find_row_from_data (GTK_CLIST (dccrwin.list), (gpointer) dcc);

	/* percentage done */
	per = (float) ((dcc->pos * 100.00) / dcc->size);

	snprintf (pos, sizeof (pos), "%d", dcc->pos);
	snprintf (cps, sizeof (cps), "%d", dcc->cps);
	snprintf (perc, sizeof (perc), "%.0f%%", per);

	gtk_clist_freeze (GTK_CLIST (dccrwin.list));
	gtk_clist_set_text (GTK_CLIST (dccrwin.list), row, 0,
							  _(dccstat[(int) dcc->dccstat].name));
	gtk_clist_set_text (GTK_CLIST (dccrwin.list), row, 3, pos);
	gtk_clist_set_text (GTK_CLIST (dccrwin.list), row, 4, perc);
	gtk_clist_set_text (GTK_CLIST (dccrwin.list), row, 5, cps);
	if (dcc->cps != 0)
	{
		to_go = (dcc->size - dcc->pos) / dcc->cps;
		snprintf (eta, sizeof (eta), "%.2d:%.2d:%.2d",
					 to_go / 3600, (to_go / 60) % 60, to_go % 60);
	} else
		strcpy (eta, "--:--:--");
	gtk_clist_set_text (GTK_CLIST (dccrwin.list), row, 6, eta);
	if (dccstat[(int) dcc->dccstat].color != 1)
		gtk_clist_set_foreground
			(GTK_CLIST (dccrwin.list), row,
			 colors + dccstat[(int) dcc->dccstat].color);
#ifdef USE_GNOME
	if (dcc->dccstat == STAT_DONE)
		gtk_clist_set_text (GTK_CLIST (dccrwin.list), row, 8,
								  (char *) gnome_mime_type_of_file (dcc->destfile));
#endif
	gtk_clist_thaw (GTK_CLIST (dccrwin.list));
}
Ejemplo n.º 12
0
void
gradient_select_rename_all (gradient_t *gradient)
{
  GradientSelect *gsp; 
  GSList         *list;
  gint            row;

  for (list = gradient_active_dialogs; list; list = g_slist_next (list))
    {
      gsp = (GradientSelect *) list->data;

      row = gtk_clist_find_row_from_data (GTK_CLIST (gsp->clist), gradient);
		/*
      if (row > -1)
		  gtk_clist_set_text (GTK_CLIST (gsp->clist), row, 1, gradient->name);  
		*/
    }
}
Ejemplo n.º 13
0
/**
 * Update the row with the given nodeinfo. If row is -1 the row number
 * is determined by the node_id contained in the gnet_node_info_t.
 */
static void
nodes_gui_update_node_info(gnet_node_info_t *n, gint row)
{
    GtkCList *clist = GTK_CLIST(gui_main_window_lookup("clist_nodes"));

    g_assert(n != NULL);

    if (row == -1) {
        row = gtk_clist_find_row_from_data(clist,
					deconstify_gpointer(n->node_id));
    }

    if (row != -1) {
		gchar ver_buf[64];
        gnet_node_status_t status;
        time_t now = tm_time();

        if (guc_node_get_status(n->node_id, &status)) {
			gtk_clist_set_text(clist, row, c_gnet_user_agent,
					n->vendor ? lazy_utf8_to_locale(n->vendor) : "...");

			gtk_clist_set_text(clist, row, c_gnet_loc,
					deconstify_gchar(iso3166_country_cc(n->country)));

			str_bprintf(ver_buf, sizeof ver_buf, "%d.%d",
					n->proto_major, n->proto_minor);
			gtk_clist_set_text(clist, row, c_gnet_version, ver_buf);

			if (status.status == GTA_NODE_CONNECTED)
				gtk_clist_set_text(clist, row, c_gnet_connected,
						short_uptime(delta_time(now, status.connect_date)));

			if (status.up_date)
				gtk_clist_set_text(clist, row, c_gnet_uptime,
						status.up_date
						? short_uptime(delta_time(now, status.up_date)) : "...");

			gtk_clist_set_text(clist, row, c_gnet_info,
					nodes_gui_common_status_str(&status));
		}
    } else {
        g_warning("%s(): no matching row found", G_STRFUNC);
    }
}
Ejemplo n.º 14
0
void
fe_dcc_update_send (struct DCC *dcc)
{
	char pos[14], cps[14], ack[14], perc[14], eta[14];
	gint row;
	int to_go;
	float per;

	if (!dccswin.window)
		return;

	row =
		gtk_clist_find_row_from_data (GTK_CLIST (dccswin.list), (gpointer) dcc);

	/* percentage ack'ed */
	per = (float) ((dcc->ack * 100.00) / dcc->size);

	snprintf (pos, sizeof (pos), "%d", dcc->pos);
	snprintf (cps, sizeof (cps), "%d", dcc->cps);
	snprintf (ack, sizeof (ack), "%d", dcc->ack);
	snprintf (perc, sizeof (perc), "%.0f%%", per);
	if (dcc->cps != 0)
	{
		to_go = (dcc->size - dcc->ack) / dcc->cps;
		snprintf (eta, sizeof (eta), "%.2d:%.2d:%.2d",
					 to_go / 3600, (to_go / 60) % 60, to_go % 60);
	} else
		strcpy (eta, "--:--:--");
	gtk_clist_freeze (GTK_CLIST (dccswin.list));
	gtk_clist_set_text (GTK_CLIST (dccswin.list), row, 0,
							  _(dccstat[(int) dcc->dccstat].name));
	if (dccstat[(int) dcc->dccstat].color != 1)
		gtk_clist_set_foreground
			(GTK_CLIST (dccswin.list), row,
			 colors + dccstat[(int) dcc->dccstat].color);
	gtk_clist_set_text (GTK_CLIST (dccswin.list), row, 3, pos);
	gtk_clist_set_text (GTK_CLIST (dccswin.list), row, 4, ack);
	gtk_clist_set_text (GTK_CLIST (dccswin.list), row, 5, perc);
	gtk_clist_set_text (GTK_CLIST (dccswin.list), row, 6, cps);
	gtk_clist_set_text (GTK_CLIST (dccswin.list), row, 7, eta);
	gtk_clist_thaw (GTK_CLIST (dccswin.list));
}
Ejemplo n.º 15
0
void DownloadUI::RemoveItem(DownloadItem *dli)
{
    if (!dli || !m_List || !isVisible)
        return;

    int row = gtk_clist_find_row_from_data(GTK_CLIST(m_List), (gpointer)dli);

    if (row < 0)
        return;

    gtk_clist_remove(GTK_CLIST(m_List), row);

    vector<DownloadItem *>::iterator i = downloadList.begin();
    for (; i != downloadList.end(); i++) {
        if ((*i) == dli) 
            break;
    }
    if (i != downloadList.end())
        downloadList.erase(i);
}
Ejemplo n.º 16
0
void DownloadUI::UpdateItem(DownloadItem *dli)
{
    if (!dli || !m_List || !isVisible)
        return;

    int row = gtk_clist_find_row_from_data(GTK_CLIST(m_List), (gpointer)dli);

    if (row < 0)
        return;

    char *iText[2];
    iText[0] = (char *)StatusString(dli).c_str();
    if (gtk_clist_get_text(GTK_CLIST(m_List), row, 1, &iText[1])) {
        if (!strcmp(iText[0], iText[1]))
            return;
    }

    gtk_clist_set_text(GTK_CLIST(m_List), row, 1, iText[0]);

    if (row == (int)m_currentindex) 
        SelChangeEvent(m_currentindex);
}
Ejemplo n.º 17
0
static void
fontsel_family_select_callback (GtkCList       *clist,
				gint            row,
				gint            column,
				GdkEventButton *event,
				gpointer        data)
{
  FontFace  *font_face = NULL;
  GtkWidget *clist2    = (GtkWidget *) data;
  GTree     *family;
  gint       face_row  = 0;

  family = gtk_clist_get_row_data (clist, row);

  gtk_clist_freeze (GTK_CLIST (clist2));
  gtk_clist_clear (GTK_CLIST (clist2));
  g_tree_foreach (family,
                  (GTraverseFunc) fontsel_style_list_insert,
                  clist2);
  gtk_clist_thaw (GTK_CLIST (clist2));

  if (face_selected && face_selected->style_name)
    font_face = g_tree_lookup (family, face_selected->style_name);

  if (! font_face)
    font_face = g_tree_lookup (family, "Regular");

  if (! font_face)
    font_face = g_tree_lookup (family, "Roman");

  if (font_face)
    face_row = gtk_clist_find_row_from_data (GTK_CLIST (clist2), font_face);

  gtk_clist_select_row (GTK_CLIST (clist2), face_row, 0);

  if (! (gtk_clist_row_is_visible (GTK_CLIST (clist2), face_row) &
	 GTK_VISIBILITY_FULL))
    gtk_clist_moveto (clist, face_row, 0, 0.0, 0.0);
}
Ejemplo n.º 18
0
/**
 * Updates the flags for given node and row.
 */
static void
nodes_gui_update_node_flags(const struct nid *node_id, gnet_node_flags_t *flags,
	gint row)
{
    GtkCList *clist = GTK_CLIST(gui_main_window_lookup("clist_nodes"));

    if (row == -1)
        row = gtk_clist_find_row_from_data(clist, deconstify_gpointer(node_id));

    if (row != -1) {
        gtk_clist_set_text(clist, row, c_gnet_flags,
			guc_node_flags_to_string(flags));
	if (NODE_P_LEAF == flags->peermode || NODE_P_NORMAL == flags->peermode) {
		GdkColor *color = &(gtk_widget_get_style(GTK_WIDGET(clist))
			->fg[GTK_STATE_INSENSITIVE]);
		gtk_clist_set_foreground(clist, row, color);
	}

    } else {
        g_warning("%s(): no matching row found", G_STRFUNC);
    }
}
Ejemplo n.º 19
0
void
fontsel_set_font_by_name (GtkWidget *fontsel,
			  gchar     *family_name,
			  gchar     *style_name)
{
  GTree       *family = NULL;
  GtkCList    *clist;
  gint         row;
  StyleSelect *style_select;

  g_return_if_fail (fontsel != NULL);

  if (family_name)
    {
      family = g_tree_lookup (families, family_name);
    }

  if (family)
    {
      clist = g_object_get_data (G_OBJECT (fontsel), "family_list");
      row = gtk_clist_find_row_from_data (GTK_CLIST (clist), family);
      gtk_clist_select_row (GTK_CLIST (clist), row, 0);

      if ( !(gtk_clist_row_is_visible (clist, row) & GTK_VISIBILITY_FULL))
	gtk_clist_moveto (clist, row, 0, 0.0, 0.0);

      if (style_name)
	{
	  style_select = g_new (StyleSelect, 1);
	  style_select->fontsel    = fontsel;
	  style_select->family     = family;
	  style_select->style_name = style_name;

	  gtk_idle_add ((GtkFunction)fontsel_set_style_by_name, style_select);
	}
    }
}
Ejemplo n.º 20
0
/* This updates the directory tree to show (and select) a particular
 * directory entry, repopulating the file list with the contents of the
 * directory if not already listed */
void
dirtree_entry_show( GNode *dnode )
{
	int row;

	g_assert( NODE_IS_DIR(dnode) );

	/* Repopulate file list if directory is different */
	if (dnode != dirtree_current_dnode) {
		filelist_populate( dnode );
/* TODO: try removing this update from here */
		gui_update( );
	}

	/* Scroll directory tree to proper entry */
	row = gtk_clist_find_row_from_data( GTK_CLIST(dir_ctree_w), dnode );
	if (row >= 0)
		gtk_clist_select_row( GTK_CLIST(dir_ctree_w), row, 0 );
	else
		gtk_clist_unselect_all( GTK_CLIST(dir_ctree_w) );
	gui_clist_moveto_row( dir_ctree_w, MAX(0, row), DIRTREE_SCROLL_TIME );

	dirtree_current_dnode = dnode;
}
Ejemplo n.º 21
0
/********************************************************************\
 * gnc_query_list_refresh                                       *
 *   refreshes the list                                             *
 *                                                                  *
 * Args: list - list to refresh                                     *
 * Returns: nothing                                                 *
\********************************************************************/
void
gnc_query_list_refresh (GNCQueryList *list)
{
    GtkCList *clist = GTK_CLIST(list);
    GtkAdjustment *adjustment;
    gfloat save_value = 0.0;
    gpointer *old_focus_entry;
    gpointer *old_entry;
    gint old_focus_row;
    gint new_row;

    g_return_if_fail (list != NULL);
    g_return_if_fail (IS_GNC_QUERY_LIST(list));

    adjustment = gtk_clist_get_vadjustment (GTK_CLIST(list));
    if (adjustment != NULL)
        save_value = adjustment->value;

    old_focus_row = clist->focus_row;
    old_focus_entry = gtk_clist_get_row_data (clist, old_focus_row);

    gtk_clist_freeze (clist);
    gtk_clist_clear (clist);

    old_entry = list->current_entry;
    list->num_entries = 0;
    list->current_row = -1;
    list->current_entry = NULL;

    gnc_query_list_fill (list);

    gnc_query_list_recompute_widths (list, -1);

    if (adjustment)
    {
        save_value = CLAMP (save_value, adjustment->lower, adjustment->upper);
        gtk_adjustment_set_value (adjustment, save_value);
    }

    if (old_entry)
    {
        new_row = gtk_clist_find_row_from_data (clist, old_entry);
        if (new_row >= 0)
        {
            list->no_toggle = TRUE;
            gtk_clist_select_row (clist, new_row, 0);
            list->no_toggle = FALSE;
            list->current_entry = old_entry;
        }
    }

    if (old_focus_entry)
    {
        new_row = gtk_clist_find_row_from_data (clist, old_focus_entry);

        if (new_row < 0)
            new_row = old_focus_row;

        if (new_row >= 0)
            clist->focus_row = new_row;
    }

    gtk_clist_thaw (clist);
}