diff options
author | Vasily_Makarov <danilka.pro@gmail.com> | 2012-01-30 20:01:13 +0400 |
---|---|---|
committer | Vasily_Makarov <danilka.pro@gmail.com> | 2012-01-30 20:01:13 +0400 |
commit | 52bc7fcc1a89355d51fe55ab160f9bcc2842fa3e (patch) | |
tree | 0ebd0d9607086151bc96ca697a08d7bd113c7fe9 | |
parent | 413481aae53a25e49f591b611e806ce443ad1832 (diff) | |
download | evol-tools-52bc7fcc1a89355d51fe55ab160f9bcc2842fa3e.tar.gz evol-tools-52bc7fcc1a89355d51fe55ab160f9bcc2842fa3e.tar.bz2 evol-tools-52bc7fcc1a89355d51fe55ab160f9bcc2842fa3e.tar.xz evol-tools-52bc7fcc1a89355d51fe55ab160f9bcc2842fa3e.zip |
Porting SAE to GTK+ 3.2
-rw-r--r-- | saedit/Makefile | 4 | ||||
-rw-r--r-- | saedit/config.c | 2 | ||||
-rw-r--r-- | saedit/config.h | 2 | ||||
-rw-r--r-- | saedit/interface.c | 6 | ||||
-rw-r--r-- | saedit/main.c | 40 | ||||
-rw-r--r-- | saedit/main.h | 7 | ||||
-rw-r--r-- | saedit/sae.h | 2 | ||||
-rw-r--r-- | saedit/search.c | 4 | ||||
-rw-r--r-- | saedit/search.h | 2 | ||||
-rw-r--r-- | saedit/xml.h | 2 |
10 files changed, 35 insertions, 36 deletions
diff --git a/saedit/Makefile b/saedit/Makefile index 19158d3..ede29b1 100644 --- a/saedit/Makefile +++ b/saedit/Makefile @@ -8,10 +8,10 @@ endif LDFLAGS += -export-dynamic -GTK_CFLAGS = `pkg-config --cflags gtk+-2.0 gtksourceview-2.0` +GTK_CFLAGS = `pkg-config --cflags gtk+-3.0 gtksourceview-3.0` IBUS_CFLAGS = `pkg-config --cflags ibus-1.0` -GTK_LDFLAGS = `pkg-config --libs gtk+-2.0 gtksourceview-2.0` +GTK_LDFLAGS = `pkg-config --libs gtk+-3.0 gtksourceview-3.0` IBUS_LDFLAGS = `pkg-config --libs ibus-1.0` IBUS_FLAGS = ${IBUS_CFLAGS} ${IBUS_LDFLAGS} diff --git a/saedit/config.c b/saedit/config.c index f28ab54..51d554d 100644 --- a/saedit/config.c +++ b/saedit/config.c @@ -60,7 +60,7 @@ void config_keys_save(Keys *keys) { mkdir(KEYS_CONFIG_DIR, S_IRWXU); int fd = g_creat(KEYS_CONFIG_FILE, S_IREAD | S_IWRITE); gchar *buf = g_key_file_to_data(key_file, NULL, NULL); - write(fd, buf, strlen(buf), NULL); + write(fd, buf, strlen(buf)); close(fd); g_key_file_free(key_file); diff --git a/saedit/config.h b/saedit/config.h index e8e064a..99f3da3 100644 --- a/saedit/config.h +++ b/saedit/config.h @@ -13,7 +13,7 @@ #define CONFIG_H #include <glib.h> -#include <ibusxml.h> +#include <ibus.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> diff --git a/saedit/interface.c b/saedit/interface.c index cda7493..0cee0e5 100644 --- a/saedit/interface.c +++ b/saedit/interface.c @@ -28,7 +28,7 @@ void save_dialog_response_callback(GtkWidget *dialog, gint response_id, gpointer } void save_dialog_show() { - GtkDialog *dialog = gtk_file_chooser_dialog_new(_("Save file as..."), win, GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL); + GtkDialog *dialog = GTK_DIALOG(gtk_file_chooser_dialog_new(_("Save file as..."), GTK_WINDOW(win), GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL)); g_signal_connect(dialog, "response", G_CALLBACK(save_dialog_response_callback), NULL); gtk_dialog_run(dialog); } @@ -49,8 +49,8 @@ void xml_file_save_button_callback(GtkWidget *button, gpointer user_data) { void file_new() { GtkTextIter start, end; - gtk_text_buffer_get_bounds(source_buffer, &start, &end); - gtk_text_buffer_delete(source_buffer, &start, &end); + gtk_text_buffer_get_bounds(GTK_TEXT_BUFFER(source_buffer), &start, &end); + gtk_text_buffer_delete(GTK_TEXT_BUFFER(source_buffer), &start, &end); gchar *temp; if (g_file_get_contents(FILE_TEMPLATE, &temp, NULL, NULL)) gtk_text_buffer_set_text(GTK_TEXT_BUFFER(source_buffer), temp, -1); diff --git a/saedit/main.c b/saedit/main.c index bf5b5e4..ccf91a0 100644 --- a/saedit/main.c +++ b/saedit/main.c @@ -49,12 +49,12 @@ gboolean darea_expose_event(GtkWidget *widget, GdkEventExpose *event, SAEInfo *s if (sae_info == NULL) sae_info = gen_sae_info; - int width = widget->allocation.width, - height = widget->allocation.height; + int width = gtk_widget_get_allocated_width(widget), + height = gtk_widget_get_allocated_height(widget); int w = 3, h = 3; - cairo_t *cr = gdk_cairo_create(widget->window); + cairo_t *cr = gdk_cairo_create(gtk_widget_get_parent_window(widget)); cairo_surface_t *surface = get_grid_surface(w, h); cairo_set_source_surface(cr, surface, width/2 - GRID_SIZE * (w + 2) * 0.5, height/2 - GRID_SIZE * (h + 2) * 0.5); @@ -84,7 +84,7 @@ gboolean darea_expose_event(GtkWidget *widget, GdkEventExpose *event, SAEInfo *s //String functions (common) gchar *markup_bold(gchar *str) { - gchar *buffer[255]; + gchar buffer[255]; g_sprintf(buffer, "<b>%s</b>", str); return buffer; } @@ -104,7 +104,7 @@ void open_xml_file(GtkButton *button) { size_t len; g_file_get_contents(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(xml_file_chooser_button)), &buf, &len, NULL); if (g_utf8_validate(buf, len, NULL)) { - gtk_text_buffer_set_text(source_buffer, buf, len); + gtk_text_buffer_set_text(GTK_TEXT_BUFFER(source_buffer), buf, len); gtk_widget_set_sensitive(xml_file_save_button, TRUE); } else { gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(xml_file_chooser_button)); @@ -115,9 +115,9 @@ void open_xml_file(GtkButton *button) { void save_to_xml_file(gchar *filename) { GtkTextIter start, end; - gtk_text_buffer_get_start_iter(source_buffer, &start); - gtk_text_buffer_get_end_iter(source_buffer, &end); - g_file_set_contents(filename, gtk_text_buffer_get_text(source_buffer, &start, &end, NULL), -1, NULL); + gtk_text_buffer_get_start_iter(GTK_TEXT_BUFFER(source_buffer), &start); + gtk_text_buffer_get_end_iter(GTK_TEXT_BUFFER(source_buffer), &end); + g_file_set_contents(filename, gtk_text_buffer_get_text(GTK_TEXT_BUFFER(source_buffer), &start, &end, NULL), -1, NULL); } //SAEInfo functions (must be ported to sae.c) @@ -186,24 +186,24 @@ void show_wrong_source_buffer_dialog() { gtk_widget_show_all(dialog); } -void actions_combo_box_changed_callback(GtkComboBox *widget, gpointer user_data) { +void actions_combo_box_changed_callback(GtkComboBoxText *widget, gpointer user_data) { if (player != NULL) - set_up_action_by_name(gtk_combo_box_get_active_text(widget), player); - set_up_action_by_name(gtk_combo_box_get_active_text(widget), gen_sae_info); + set_up_action_by_name(gtk_combo_box_text_get_active_text(widget), player); + set_up_action_by_name(gtk_combo_box_text_get_active_text(widget), gen_sae_info); } -void animations_combo_box_changed_callback(GtkComboBox *widget, gpointer user_data) { - set_up_animation_by_direction(gen_sae_info, gtk_combo_box_get_active_text(widget)); +void animations_combo_box_changed_callback(GtkComboBoxText *widget, gpointer user_data) { + set_up_animation_by_direction(gen_sae_info, gtk_combo_box_text_get_active_text(widget)); if (player != NULL) { - set_up_animation_by_direction(player, gtk_combo_box_get_active_text(widget)); + set_up_animation_by_direction(player, gtk_combo_box_text_get_active_text(widget)); show_animation(player); } show_animation(gen_sae_info); } -void imagesets_combo_box_changed_callback(GtkComboBox *widget, gpointer user_data) { - if (gtk_combo_box_get_active_text(widget) != NULL) - set_up_imageset_by_name(gtk_combo_box_get_active_text(widget), gen_sae_info); +void imagesets_combo_box_changed_callback(GtkComboBoxText *widget, gpointer user_data) { + if (gtk_combo_box_text_get_active_text(widget) != NULL) + set_up_imageset_by_name(gtk_combo_box_text_get_active_text(widget), gen_sae_info); } gboolean frame_image_button_press_event_callback(GtkWidget *widget, GdkEventButton *button, int index) { @@ -280,7 +280,7 @@ void set_up_actions_by_imageset_name(gchar *imageset_name, SAEInfo *sae_info) { g_list_append(_actions_list, list->data); node = list->data; if (sae_info->actions_combo_box != NULL) - gtk_combo_box_append_text(GTK_COMBO_BOX(sae_info->actions_combo_box), xml_node_get_attr_value(node, "name")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX(sae_info->actions_combo_box), xml_node_get_attr_value(node, "name")); list = list->next; } if (sae_info->actions_combo_box != NULL); @@ -304,7 +304,7 @@ gboolean set_up_imagesets(SAEInfo *sae_info) { g_list_append(_imagesets_list, list->data); node = list->data; if (sae_info->imagesets_combo_box != NULL) - gtk_combo_box_append_text(GTK_COMBO_BOX(sae_info->imagesets_combo_box), xml_node_get_attr_value(node, "name")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX(sae_info->imagesets_combo_box), xml_node_get_attr_value(node, "name")); list = list->next; } if (_imagesets_list == NULL) @@ -354,7 +354,7 @@ gboolean set_up_action_by_name(const gchar *name, SAEInfo *sae_info) { gchar *direction = xml_node_get_attr_value(node, "direction"); if (direction != NULL) { if (sae_info->animations_combo_box != NULL) - gtk_combo_box_append_text(GTK_COMBO_BOX(sae_info->animations_combo_box), direction); + gtk_combo_box_text_append_text(GTK_COMBO_BOX(sae_info->animations_combo_box), direction); was_direction = TRUE; } list = list->next; diff --git a/saedit/main.h b/saedit/main.h index af78d8f..3b6e519 100644 --- a/saedit/main.h +++ b/saedit/main.h @@ -16,7 +16,6 @@ #include <gtk/gtk.h> #include <gtksourceview/gtksourceview.h> #include <gtksourceview/gtksourcelanguagemanager.h> -#include <gtksourceview/gtksourceiter.h> #include <cairo.h> #include <glib/gi18n.h> @@ -83,8 +82,8 @@ void free_current_info(); void data_folder_set_callback(GtkFileChooserButton *widget, gpointer data); void show_wrong_source_buffer_dialog(); void show_grid_menu_item_toggled_callback(GtkCheckMenuItem *checkmenuitem, gpointer user_data); -void actions_combo_box_changed_callback(GtkComboBox *widget, gpointer user_data); -void imagesets_combo_box_changed_callback(GtkComboBox *widget, gpointer user_data); +void actions_combo_box_changed_callback(GtkComboBoxText *widget, gpointer user_data); +void imagesets_combo_box_changed_callback(GtkComboBoxText *widget, gpointer user_data); void open_menu_item_activate_callback(GtkMenuItem *menuitem, GtkFileChooserDialog *fcdialog); gboolean frame_image_button_press_event_callback(GtkWidget *widget, GdkEventButton *button, int index); @@ -97,7 +96,7 @@ void set_up_actions_by_imageset_name(gchar *imageset_name, SAEInfo *sae_info); gboolean set_up_imagesets(SAEInfo *sae_info); gboolean show_general_animation(SAEInfo *sae_info); gboolean set_up_action_by_name(const gchar *name, SAEInfo *sae_info); -void animations_combo_box_changed_callback(GtkComboBox *widget, gpointer user_data); +void animations_combo_box_changed_callback(GtkComboBoxText *widget, gpointer user_data); void set_up_imageset_by_name(const gchar* name, SAEInfo *sae_info); void parse_xml_buffer(GtkWidget *button, GtkSourceBuffer *buffer); void set_up_interface(); diff --git a/saedit/sae.h b/saedit/sae.h index b6867e3..12d10e6 100644 --- a/saedit/sae.h +++ b/saedit/sae.h @@ -13,7 +13,7 @@ #define SAE_H #include <gtk/gtk.h> -#include <ibusxml.h> +#include <ibus.h> #include "common.h" #include "xml.h" diff --git a/saedit/search.c b/saedit/search.c index f98063f..245b006 100644 --- a/saedit/search.c +++ b/saedit/search.c @@ -25,11 +25,11 @@ gboolean search_find_text(gchar *text) { GtkTextIter m_start, m_end, start; gtk_text_buffer_get_selection_bounds(text_buffer, NULL, &start); - found = gtk_source_iter_forward_search(&start, text, GTK_SOURCE_SEARCH_CASE_INSENSITIVE, &m_start, &m_end, NULL); + found = gtk_text_iter_forward_search(&start, text, 4, &m_start, &m_end, NULL); if (!found) { gtk_text_buffer_get_start_iter(text_buffer, &start); - found = gtk_source_iter_forward_search(&start, text, GTK_SOURCE_SEARCH_CASE_INSENSITIVE, &m_start, &m_end, NULL); + found = gtk_text_iter_forward_search(&start, text, 4, &m_start, &m_end, NULL); } if (found) { diff --git a/saedit/search.h b/saedit/search.h index 350bc70..4d41735 100644 --- a/saedit/search.h +++ b/saedit/search.h @@ -13,7 +13,7 @@ #define SEARCH_H #include <gtk/gtk.h> -#include <gtksourceview/gtksourceiter.h> +#include <gtksourceview/gtksourceview.h> #include "common.h" void search_init(GtkWidget *text_view); diff --git a/saedit/xml.h b/saedit/xml.h index 2a8875e..4c02ce9 100644 --- a/saedit/xml.h +++ b/saedit/xml.h @@ -12,7 +12,7 @@ #define XML_H #include <glib.h> -#include <ibusxml.h> +#include <ibus.h> #include "common.h" gchar **xml_attr_new(gchar *name, gchar *value); |