Example #1
0
void
hybrid_chat_window_set_icon(HybridChatWindow *window, GdkPixbuf *pixbuf)
{
    GtkTreeModel *model;
    GtkListStore *store;

    g_return_if_fail(window != NULL);

    if (!IS_USER_DEFINED_CHAT(window)) {
        return;
    }

    g_object_ref(pixbuf);
    window->icon = pixbuf;

    model = gtk_cell_view_get_model(GTK_CELL_VIEW(window->tablabel));
    store = GTK_LIST_STORE(model);

    gtk_list_store_set(store, &window->tabiter,
            TAB_STATUS_ICON_COLUMN, pixbuf,
            -1);

    model = gtk_cell_view_get_model(GTK_CELL_VIEW(window->tiplabel));
    store = GTK_LIST_STORE(model);

    gtk_list_store_set(store, &window->tipiter,
            BUDDY_ICON_COLUMN, pixbuf, -1);
}
Example #2
0
void
hybrid_chat_window_set_title(HybridChatWindow *window, const gchar *title)
{
    GtkTreeModel *model;
    GtkListStore *store;

    g_return_if_fail(window != NULL);

    if (!IS_USER_DEFINED_CHAT(window)) {
        return;
    }

    window->title = g_strdup(title);

    model = gtk_cell_view_get_model(GTK_CELL_VIEW(window->tablabel));
    store = GTK_LIST_STORE(model);

    gtk_list_store_set(store, &window->tabiter, TAB_NAME_COLUMN, title, -1);

    model = gtk_cell_view_get_model(GTK_CELL_VIEW(window->tiplabel));
    store = GTK_LIST_STORE(model);

    gtk_list_store_set(store, &window->tipiter, BUDDY_NAME_COLUMN, title, -1);
}
Example #3
0
void
hybrid_head_bind_to_account(HybridAccount *account)
{
	GtkTreeModel *model;
	GtkTreePath *path;
	GdkPixbuf *pixbuf;
	GdkPixbuf *status_icon;
	gchar *text;

	model = gtk_cell_view_get_model(GTK_CELL_VIEW(hybrid_head->cellview));

	if (!account) {
		pixbuf = hybrid_create_default_icon(32);
		text = g_strdup(_("No account was enabled."));
		status_icon = NULL;

	} else {
		pixbuf = hybrid_create_round_pixbuf(account->icon_data,
							account->icon_data_len, 32);
		text = g_strdup_printf(_("<b>%s</b> [%s]\n<small>%s</small>"), 
							account->nickname,
							hybrid_get_presence_name(account->state),
							account->status_text ? account->status_text : "");
		status_icon = hybrid_create_presence_pixbuf(account->state, 16);
	}


	gtk_list_store_set(GTK_LIST_STORE(model), &hybrid_head->iter,
					HYBRID_HEAD_PIXBUF_COLUMN, pixbuf,
					HYBRID_HEAD_NAME_COLUMN, text,
					HYBRID_HEAD_STATUS_ICON_COLUMN, status_icon,
					-1);

	path = gtk_tree_path_new_from_string("0");
	gtk_cell_view_set_displayed_row(GTK_CELL_VIEW(hybrid_head->cellview), path);
	gtk_tree_path_free(path);
	
	g_object_unref(pixbuf);
	if (status_icon) {
		g_object_unref(status_icon);
	}
	g_free(text);
}
Example #4
0
static gchar *
get_text_from_label_widget (GtkWidget *label)
{
  if (GTK_IS_LABEL (label))
    return g_strdup (gtk_label_get_text (GTK_LABEL (label)));
  else if (GTK_IS_CELL_VIEW (label))
    {
      GList *cells, *l;
      GtkTreeModel *model;
      GtkTreeIter iter;
      GtkTreePath *path;
      GtkCellArea *area;
      gchar *text;

      model = gtk_cell_view_get_model (GTK_CELL_VIEW (label));
      path = gtk_cell_view_get_displayed_row (GTK_CELL_VIEW (label));
      gtk_tree_model_get_iter (model, &iter, path);
      gtk_tree_path_free (path);

      area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (label));
      gtk_cell_area_apply_attributes (area, model, &iter, FALSE, FALSE);
      cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (label));

      text = NULL;
      for (l = cells; l; l = l->next)
        {
          GtkCellRenderer *cell = l->data;

          if (GTK_IS_CELL_RENDERER_TEXT (cell))
            {
              g_object_get (cell, "text", &text, NULL);
              break;
            }
        }

      g_list_free (cells);

      return text;
    }

  return NULL;
}
Example #5
0
void
hybrid_chat_window_update_tips(HybridChatWindow *window)
{
    GtkTreeModel       *model;
    GtkTreePath        *path;
    HybridConversation *conv;
    HybridBuddy        *buddy;
    gchar              *markup;

    g_return_if_fail(window != NULL);

    if (!IS_SYSTEM_CHAT(window)) {
        return;
    }

    conv = window->parent;
    buddy = window->data;

    model = gtk_cell_view_get_model(GTK_CELL_VIEW(window->tablabel));

    if (window->unread) {
        markup = g_strdup_printf("<span color=\"blue\"><b>%s (%d)</b></span>",
                                buddy->name, window->unread);

    } else {
        markup = g_strdup(buddy->name);
    }

    gtk_list_store_set(GTK_LIST_STORE(model), &window->tabiter,
                       TAB_NAME_COLUMN, markup,
                       -1);

    g_free(markup);

    path = gtk_tree_path_new_from_string("0");
    gtk_cell_view_set_displayed_row(GTK_CELL_VIEW(window->tablabel), path);
    gtk_tree_path_free(path);

}