summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--codeshare-contact-selector.c53
-rw-r--r--codeshare-contact-selector.h4
-rw-r--r--codeshare.c14
3 files changed, 63 insertions, 8 deletions
diff --git a/codeshare-contact-selector.c b/codeshare-contact-selector.c
index 0eef0a4..fafd689 100644
--- a/codeshare-contact-selector.c
+++ b/codeshare-contact-selector.c
@@ -28,7 +28,7 @@
#define GET_PRIV(obj) ((CodeshareContactSelectorPriv *) ((CodeshareContactSelector *) obj)->priv)
-G_DEFINE_TYPE (CodeshareContactSelector, codeshare_contact_selector, GTK_TYPE_WIDGET);
+G_DEFINE_TYPE (CodeshareContactSelector, codeshare_contact_selector, GTK_TYPE_VBOX);
typedef struct
@@ -36,8 +36,39 @@ typedef struct
TpAccount *my_account;
TpProxySignalConnection *proxy_signal_connection;
TpChannel *channel;
+
+ GtkTreeStore *store;
+ GtkWidget *view;
} CodeshareContactSelectorPriv;
+enum
+{
+ //~TP_CONTACT_COLUMN,
+ TEST_STRING_COLUMN,
+ N_COLUMNS
+};
+
+static void
+contact_selector_fill_model (CodeshareContactSelector *self)
+{
+ CodeshareContactSelectorPriv *priv = GET_PRIV (self);
+ GtkTreeIter iter;
+
+ gtk_tree_store_append (priv->store, &iter, NULL);
+ gtk_tree_store_set (priv->store, &iter,
+ TEST_STRING_COLUMN, "testcontact",
+ -1);
+
+ gtk_tree_store_append (priv->store, &iter, NULL);
+ gtk_tree_store_set (priv->store, &iter,
+ TEST_STRING_COLUMN, "testcontact2",
+ -1);
+
+ gtk_tree_store_append (priv->store, &iter, NULL);
+ gtk_tree_store_set (priv->store, &iter,
+ TEST_STRING_COLUMN, "testcontact3",
+ -1);
+}
static void
codeshare_contact_selector_class_init (CodeshareContactSelectorClass *klass)
@@ -52,8 +83,26 @@ codeshare_contact_selector_init (CodeshareContactSelector *self)
{
CodeshareContactSelectorPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
CODESHARE_TYPE_CONTACT_SELECTOR, CodeshareContactSelectorPriv);
-
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+
self->priv = priv;
+
+ //~priv->store = gtk_tree_store_new (N_COLUMNS, TP_TYPE_CONTACT);
+ priv->store = gtk_tree_store_new (N_COLUMNS, G_TYPE_STRING);
+ contact_selector_fill_model (self);
+
+ priv->view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (priv->store));
+ gtk_widget_show (priv->view);
+ gtk_box_pack_start (GTK_BOX (self), priv->view, TRUE, TRUE, 0);
+
+ renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes ("Contacts",
+ renderer,
+ "text", TEST_STRING_COLUMN,
+ NULL);
+
+ gtk_tree_view_append_column (GTK_TREE_VIEW (priv->view), column);
}
GtkWidget *
diff --git a/codeshare-contact-selector.h b/codeshare-contact-selector.h
index fde7d52..c86a6c7 100644
--- a/codeshare-contact-selector.h
+++ b/codeshare-contact-selector.h
@@ -36,13 +36,13 @@ typedef struct _CodeshareContactSelectorClass CodeshareContactSelectorClass;
struct _CodeshareContactSelector
{
- GtkWidget parent;
+ GtkVBox parent;
gpointer priv;
};
struct _CodeshareContactSelectorClass
{
- GtkWidgetClass parent_class;
+ GtkVBoxClass parent_class;
};
GType codeshare_contact_selector_get_type (void) G_GNUC_CONST;
diff --git a/codeshare.c b/codeshare.c
index e7bb58b..2c2c054 100644
--- a/codeshare.c
+++ b/codeshare.c
@@ -21,6 +21,7 @@
#include "geanyplugin.h"
#include "codeshare-chat.h"
+#include "codeshare-contact-selector.h"
GeanyPlugin *geany_plugin;
GeanyData *geany_data;
@@ -70,7 +71,8 @@ show_select_contact_dialog (GeanyData *gdata)
{
GtkWidget *dialog;
GtkWidget *content;
- GtkWidget *content_label;
+ //~GtkWidget *content_label;
+ GtkWidget *contact_selector;
gint response_id;
dialog = gtk_dialog_new_with_buttons ("Select a contact",
@@ -81,9 +83,13 @@ show_select_contact_dialog (GeanyData *gdata)
NULL);
content = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
- content_label = gtk_label_new ("testlabel");
- gtk_widget_show (content_label);
- gtk_container_add (GTK_CONTAINER (content), content_label);
+ //~content_label = gtk_label_new ("testlabel");
+ //~gtk_widget_show (content_label);
+ //~gtk_container_add (GTK_CONTAINER (content), content_label);
+
+ contact_selector = codeshare_contact_selector_new ();
+ gtk_widget_show (contact_selector);
+ gtk_container_add (GTK_CONTAINER (content), contact_selector);
response_id = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);